APIController { @GetMapping(value = "/public") public Message publicEndpoint() { return new Message("All good. You DO NOT need to be authenticated to call /api/public."); }  @GetMapping(value = "/public") Message publicEndpoint(); @GetMapping(value = "/private") Message privateEndpoint(); @GetMapping(value = "/private-scoped") Message privateScopedEndpoint();  }
@Test public void testPublicEndpoint() throws Exception { MvcResult mvcResult = mockMvc.perform(get("/api/public")) .andDo(print()) .andExpect(status().isOk()) .andReturn(); assertNotNull(mvcResult.getResponse().getContentAsString()); }