+
+ @Test
+ void getGreetingIfBackendHeaderIsNotSet(@Autowired MockMvc mvc) throws Exception
+ {
+ mvc
+ .perform(post("/peter")
+ .header(ACCEPT, "application/json")
+ .header(BACKEND_VERSION, projectVersion)
+ .content("Hello TO_NAME, nice to meet you. I'm FROM_NAME."))
+ .andExpect(status().isOk())
+ .andExpect(content().json("{\"greeting\": \"Hello peter, nice to meet you. I'm FOO@BAR.\"}"));
+ }
+
+ @Test
+ void getGreetingIfBackendHeaderDoesMatch(@Autowired MockMvc mvc) throws Exception
+ {
+ mvc
+ .perform(post("/peter")
+ .header(ACCEPT, "application/json")
+ .header(BACKEND_VERSION, "FOO")
+ .content("Hello TO_NAME, nice to meet you. I'm FROM_NAME."))
+ .andExpect(status().isGone());
+ }
+
+ @Test
+ void getGreetingIfBackendHeaderDoesNotMatch(@Autowired MockMvc mvc) throws Exception
+ {
+ mvc
+ .perform(post("/peter")
+ .header(ACCEPT, "application/json")
+ .content("Hello TO_NAME, nice to meet you. I'm FROM_NAME."))
+ .andExpect(status().isOk())
+ .andExpect(content().json("{\"greeting\": \"Hello peter, nice to meet you. I'm FOO@BAR.\"}"));
+ }