@Ignore("Remove until difference in time on build machine is figured out.")
@Test
public void testAuthenticationToken() {

    final UserEntity userEntity = new UserEntity();
    userEntity.setName(VALID_USERNAME);
    userEntity.setPassword(VALID_PASSWORD);
    userEntity.setRoleEntities(Collections.emptySet());
    final DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
    final DateTime now = formatter.parseDateTime("1985-10-26 01:24:00").withZone(DateTimeZone.UTC);
    final Date expiry = new Date(1_000_000_000L);
    Mockito.when(mockUserService.findByName(VALID_USERNAME)).thenReturn(userEntity);
    Mockito.when(mockDateTimeService.now()).thenReturn(now);
    Mockito.when(mockDateTimeService.plusDaysAsDate(now, 1)).thenReturn(expiry);
    final String response = defaultAuthenticationService.authenticationToken(VALID_USERNAME, VALID_PASSWORD);
    Assert.assertEquals(
        "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1c2VyIiwicm9sZXMiOltdLCJpYXQiOjQ5OTE2NjY0MCwiZXhwIjoxMDAwMDAwfQ.e14TR4Umu8UUz3GrYyXHQTkFickDFV1Vpgb8JaCz8EY",
        response);
    Mockito.verify(mockUserService).findByName(VALID_USERNAME);
    Mockito.verify(mockDateTimeService).now();
    Mockito.verify(mockDateTimeService).plusDaysAsDate(now, 1);
}