/** * Creates a new <code>{@link ShouldBeAfter}</code>. * @param actual the actual value in the failed assertion. * @param year the year to compare the actual date's year to. * @return the created {@code ErrorMessageFactory}. */ public static ErrorMessageFactory shouldBeAfter(Date actual, int year) { Date januaryTheFirstOfGivenYear = parse(year + "-01-01"); return new ShouldBeAfter(actual, januaryTheFirstOfGivenYear, StandardComparisonStrategy.instance()); }
/** * Creates a new <code>{@link ShouldBeAfter}</code>. * @param actual the actual value in the failed assertion. * @param year the year to compare the actual date's year to. * @return the created {@code ErrorMessageFactory}. */ public static ErrorMessageFactory shouldBeAfter(Date actual, int year) { Date januaryTheFirstOfGivenYear = parse(year + "-01-01"); return new ShouldBeAfter(actual, januaryTheFirstOfGivenYear, StandardComparisonStrategy.instance()); }
@Test public void getUserProfileReturnsCreationDate() { UserRepresentation userRepresentation = new UserRepresentation(); Date creationDate = DateUtil.parse("2018-01-31"); userRepresentation.setCreatedTimestamp(creationDate.getTime()); userRepresentation.setEmail("davy.van.roy@gmail.com"); when(keycloakRepository.getUser("davy")).thenReturn(userRepresentation); when(keycloakRepository.getUserIdentities("davy")).thenReturn(Stream.empty()); UserProfile userProfile = profileService.getUserProfile(() -> "davy"); assertThat(userProfile.getCreatedAt()).isEqualTo(creationDate.getTime()); }