@Test
public void validatesTokenAgainstStoredUserSessions() throws Exception {

  when(authenticationService.validate(token)).thenReturn(username);
  mockMvc.perform(
      post("/rest/validate")
          .contentType(APPLICATION_JSON_UTF8_VALUE)
          .content(objectMapper.writeValueAsBytes(new Token(token))))
      .andExpect(status().isOk())
      .andExpect(content().string(username));
}