BAEL-6572: Modified test to validateId mapping
This commit is contained in:
parent
736fe8dee1
commit
77d1de223b
@ -4,6 +4,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
@ -21,7 +22,6 @@ class LicenseMapperUnitTest {
|
|||||||
licenseDto.setStartDate(LocalDateTime.now());
|
licenseDto.setStartDate(LocalDateTime.now());
|
||||||
License license = licenseMapper.toLicense(licenseDto);
|
License license = licenseMapper.toLicense(licenseDto);
|
||||||
assertThat(license).isNotNull();
|
assertThat(license).isNotNull();
|
||||||
assertThat(license.getId()).isNotNull();
|
|
||||||
assertThat(license.getEndDate()
|
assertThat(license.getEndDate()
|
||||||
.toLocalDate()).isEqualTo(LocalDate.now()
|
.toLocalDate()).isEqualTo(LocalDate.now()
|
||||||
.plusYears(1));
|
.plusYears(1));
|
||||||
@ -34,7 +34,6 @@ class LicenseMapperUnitTest {
|
|||||||
.plusYears(2));
|
.plusYears(2));
|
||||||
License license = licenseMapper.toLicense(licenseDto);
|
License license = licenseMapper.toLicense(licenseDto);
|
||||||
assertThat(license).isNotNull();
|
assertThat(license).isNotNull();
|
||||||
assertThat(license.getId()).isNotNull();
|
|
||||||
assertThat(license.getStartDate()
|
assertThat(license.getStartDate()
|
||||||
.toLocalDate()).isEqualTo(LocalDate.now());
|
.toLocalDate()).isEqualTo(LocalDate.now());
|
||||||
}
|
}
|
||||||
@ -44,7 +43,6 @@ class LicenseMapperUnitTest {
|
|||||||
LicenseDto licenseDto = new LicenseDto();
|
LicenseDto licenseDto = new LicenseDto();
|
||||||
License license = licenseMapper.toLicense(licenseDto);
|
License license = licenseMapper.toLicense(licenseDto);
|
||||||
assertThat(license).isNotNull();
|
assertThat(license).isNotNull();
|
||||||
assertThat(license.getId()).isNotNull();
|
|
||||||
assertThat(license.getStartDate()
|
assertThat(license.getStartDate()
|
||||||
.toLocalDate()).isEqualTo(LocalDate.now());
|
.toLocalDate()).isEqualTo(LocalDate.now());
|
||||||
assertThat(license.getEndDate()
|
assertThat(license.getEndDate()
|
||||||
@ -61,8 +59,17 @@ class LicenseMapperUnitTest {
|
|||||||
.plusDays(10));
|
.plusDays(10));
|
||||||
License license = licenseMapper.toLicense(licenseDto);
|
License license = licenseMapper.toLicense(licenseDto);
|
||||||
assertThat(license).isNotNull();
|
assertThat(license).isNotNull();
|
||||||
assertThat(license.getId()).isNotNull();
|
|
||||||
assertThat(license.isRenewalRequired()).isTrue();
|
assertThat(license.isRenewalRequired()).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void givenLicenseDtoWithValidDetails_WhenMapperMethodIsInvoked_ThenLicenseShouldBePopulatedWithValidId() {
|
||||||
|
LicenseDto licenseDto = new LicenseDto();
|
||||||
|
licenseDto.setEndDate(LocalDateTime.now()
|
||||||
|
.plusDays(10));
|
||||||
|
License license = licenseMapper.toLicense(licenseDto);
|
||||||
|
assertThat(license).isNotNull();
|
||||||
|
assertThat(license.getId()).isNotNull();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user