DateTimeController { @Secured({Roles.ROLE_USER}) @RequestMapping(method = RequestMethod.GET) public DateTimeWrapper getDatetime() { return new DateTimeWrapper(DateTime.now()); }  @Secured({Roles.ROLE_USER}) @RequestMapping(method = RequestMethod.GET) DateTimeWrapper getDatetime();  }
@Test public void testGetDatetime() throws Exception { final MvcResult mvcResult = mockMvc.perform(get("/datetime")) .andExpect(status().isOk()) .andReturn(); String response = mvcResult.getResponse().getContentAsString(); String pattern = "^" + Pattern.quote("{\"dateTime\":") + "\\d{13}" + Pattern.quote("}") + "$"; assertThat("Response (" + response + ") does not match regex: " + pattern, response.matches(pattern), is(true)); }