@EntendWith(SpringExtenstion.class) //to focus on mvc components only @WebMvcTest(ClassNameYoureGoingToTest.class) class HelloControllerIntegrationTest{ @Autowired private MockMvc mvc; @Test void hello() throws Exception{ RequestBuilder request = MockMvcRequestBuilders.get("/find/by/id"); MvcResults result = mvc.perform(request).andReturn(); //first param is expected value, second- actual value assertEquals("Hello, World", results.getResponse().getContentAsString()); } @Test public void testHelloWithName throws Exception{ mvc.perform(get("/find/by/id?id=123")).andExpect(content().string("Hello, Dan")); } }