BAEL-6572: Modified test based on review comments
This commit is contained in:
parent
31682be3e3
commit
eb4a1d040e
|
@ -20,14 +20,10 @@ class LicenseMapperUnitTest {
|
||||||
License license = licenseMapper.toLicense(LicenseDto.builder()
|
License license = licenseMapper.toLicense(LicenseDto.builder()
|
||||||
.startDate(LocalDateTime.now())
|
.startDate(LocalDateTime.now())
|
||||||
.build());
|
.build());
|
||||||
assertThat(license).isNotNull()
|
assertThat(license).isNotNull();
|
||||||
.satisfies(l -> {
|
assertThat(license.getEndDate()
|
||||||
assertThat(l.getStartDate()
|
.toLocalDate()).isEqualTo(LocalDate.now()
|
||||||
.toLocalDate()).isEqualTo(LocalDate.now());
|
.plusYears(1));
|
||||||
assertThat(l.getEndDate()
|
|
||||||
.toLocalDate()).isEqualTo(LocalDate.now()
|
|
||||||
.plusYears(1));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -36,28 +32,21 @@ class LicenseMapperUnitTest {
|
||||||
.endDate(LocalDateTime.now()
|
.endDate(LocalDateTime.now()
|
||||||
.plusYears(2))
|
.plusYears(2))
|
||||||
.build());
|
.build());
|
||||||
assertThat(license).isNotNull()
|
assertThat(license).isNotNull();
|
||||||
.satisfies(l -> {
|
assertThat(license.getStartDate()
|
||||||
assertThat(l.getStartDate()
|
.toLocalDate()).isEqualTo(LocalDate.now());
|
||||||
.toLocalDate()).isEqualTo(LocalDate.now());
|
|
||||||
assertThat(l.getEndDate()
|
|
||||||
.toLocalDate()).isEqualTo(LocalDate.now()
|
|
||||||
.plusYears(2));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void givenLicenseDtoWithoutEndDateAndWithoutStartDate_WhenMapperMethodIsInvoked_ThenLicenseShouldBePopulatedWithDefaultStartDateAndEndDate() {
|
void givenLicenseDtoWithoutEndDateAndWithoutStartDate_WhenMapperMethodIsInvoked_ThenLicenseShouldBePopulatedWithDefaultStartDateAndEndDate() {
|
||||||
License license = licenseMapper.toLicense(LicenseDto.builder()
|
License license = licenseMapper.toLicense(LicenseDto.builder()
|
||||||
.build());
|
.build());
|
||||||
assertThat(license).isNotNull()
|
assertThat(license).isNotNull();
|
||||||
.satisfies(l -> {
|
assertThat(license.getStartDate()
|
||||||
assertThat(l.getStartDate()
|
.toLocalDate()).isEqualTo(LocalDate.now());
|
||||||
.toLocalDate()).isEqualTo(LocalDate.now());
|
assertThat(license.getEndDate()
|
||||||
assertThat(l.getEndDate()
|
.toLocalDate()).isEqualTo(LocalDate.now()
|
||||||
.toLocalDate()).isEqualTo(LocalDate.now()
|
.plusYears(1));
|
||||||
.plusYears(1));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -77,21 +66,13 @@ class LicenseMapperUnitTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void givenLicenseDtoWithEndDateInTwoWeeks_WhenMapperMethodIsInvoked_ThenLicenseShouldBePopulatedWithReminderSetToTrue() {
|
void givenLicenseDtoWithEndDateInTwoWeeks_WhenMapperMethodIsInvoked_ThenLicenseShouldBePopulatedWithRenewalRequiredSetToTrue() {
|
||||||
License license = licenseMapper.toLicense(LicenseDto.builder()
|
License license = licenseMapper.toLicense(LicenseDto.builder()
|
||||||
.endDate(LocalDateTime.now()
|
.endDate(LocalDateTime.now()
|
||||||
.plusDays(10))
|
.plusDays(10))
|
||||||
.build());
|
.build());
|
||||||
assertThat(license).isNotNull()
|
assertThat(license).isNotNull();
|
||||||
.satisfies(l -> {
|
assertThat(license.isRenewalRequired()).isTrue();
|
||||||
assertThat(l.getStartDate()
|
|
||||||
.toLocalDate()).isEqualTo(LocalDate.now());
|
|
||||||
assertThat(l.getEndDate()
|
|
||||||
.toLocalDate()).isEqualTo(LocalDate.now()
|
|
||||||
.plusDays(10));
|
|
||||||
assertThat(l.isActive()).isTrue();
|
|
||||||
assertThat(l.isRenewalRequired()).isTrue();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue