BAEL-6572: Modified dto to remove lombok annotation as per guidelines and review comment
This commit is contained in:
parent
17675c8775
commit
7128b5f44d
|
@ -3,13 +3,6 @@ package com.baeldung.expression.dto;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@AllArgsConstructor
|
|
||||||
@Data
|
|
||||||
@Builder
|
|
||||||
public class LicenseDto {
|
public class LicenseDto {
|
||||||
|
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
@ -18,4 +11,24 @@ public class LicenseDto {
|
||||||
|
|
||||||
private LocalDateTime endDate;
|
private LocalDateTime endDate;
|
||||||
|
|
||||||
|
public UUID getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDateTime getStartDate() {
|
||||||
|
return startDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartDate(LocalDateTime startDate) {
|
||||||
|
this.startDate = startDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDateTime getEndDate() {
|
||||||
|
return endDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndDate(LocalDateTime endDate) {
|
||||||
|
this.endDate = endDate;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,9 +17,9 @@ class LicenseMapperUnitTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void givenLicenseDtoWithStartDateAndWithoutEndDate_WhenMapperMethodIsInvoked_ThenLicenseShouldBePopulatedWithDefaultEndDate() {
|
void givenLicenseDtoWithStartDateAndWithoutEndDate_WhenMapperMethodIsInvoked_ThenLicenseShouldBePopulatedWithDefaultEndDate() {
|
||||||
License license = licenseMapper.toLicense(LicenseDto.builder()
|
LicenseDto licenseDto = new LicenseDto();
|
||||||
.startDate(LocalDateTime.now())
|
licenseDto.setStartDate(LocalDateTime.now());
|
||||||
.build());
|
License license = licenseMapper.toLicense(licenseDto);
|
||||||
assertThat(license).isNotNull();
|
assertThat(license).isNotNull();
|
||||||
assertThat(license.getEndDate()
|
assertThat(license.getEndDate()
|
||||||
.toLocalDate()).isEqualTo(LocalDate.now()
|
.toLocalDate()).isEqualTo(LocalDate.now()
|
||||||
|
@ -28,10 +28,10 @@ class LicenseMapperUnitTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void givenLicenseDtoWithEndDateAndWithoutStartDate_WhenMapperMethodIsInvoked_ThenLicenseShouldBePopulatedWithDefaultStartDate() {
|
void givenLicenseDtoWithEndDateAndWithoutStartDate_WhenMapperMethodIsInvoked_ThenLicenseShouldBePopulatedWithDefaultStartDate() {
|
||||||
License license = licenseMapper.toLicense(LicenseDto.builder()
|
LicenseDto licenseDto = new LicenseDto();
|
||||||
.endDate(LocalDateTime.now()
|
licenseDto.setEndDate(LocalDateTime.now()
|
||||||
.plusYears(2))
|
.plusYears(2));
|
||||||
.build());
|
License license = licenseMapper.toLicense(licenseDto);
|
||||||
assertThat(license).isNotNull();
|
assertThat(license).isNotNull();
|
||||||
assertThat(license.getStartDate()
|
assertThat(license.getStartDate()
|
||||||
.toLocalDate()).isEqualTo(LocalDate.now());
|
.toLocalDate()).isEqualTo(LocalDate.now());
|
||||||
|
@ -39,8 +39,8 @@ class LicenseMapperUnitTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void givenLicenseDtoWithoutStartDateAndEndDate_WhenMapperMethodIsInvoked_ThenLicenseShouldBePopulatedWithDefaultDetails() {
|
void givenLicenseDtoWithoutStartDateAndEndDate_WhenMapperMethodIsInvoked_ThenLicenseShouldBePopulatedWithDefaultDetails() {
|
||||||
License license = licenseMapper.toLicense(LicenseDto.builder()
|
LicenseDto licenseDto = new LicenseDto();
|
||||||
.build());
|
License license = licenseMapper.toLicense(licenseDto);
|
||||||
assertThat(license).isNotNull();
|
assertThat(license).isNotNull();
|
||||||
assertThat(license.getStartDate()
|
assertThat(license.getStartDate()
|
||||||
.toLocalDate()).isEqualTo(LocalDate.now());
|
.toLocalDate()).isEqualTo(LocalDate.now());
|
||||||
|
@ -53,10 +53,10 @@ class LicenseMapperUnitTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void givenLicenseDtoWithEndDateInTwoWeeks_WhenMapperMethodIsInvoked_ThenLicenseShouldBePopulatedWithRenewalRequiredSetToTrue() {
|
void givenLicenseDtoWithEndDateInTwoWeeks_WhenMapperMethodIsInvoked_ThenLicenseShouldBePopulatedWithRenewalRequiredSetToTrue() {
|
||||||
License license = licenseMapper.toLicense(LicenseDto.builder()
|
LicenseDto licenseDto = new LicenseDto();
|
||||||
.endDate(LocalDateTime.now()
|
licenseDto.setEndDate(LocalDateTime.now()
|
||||||
.plusDays(10))
|
.plusDays(10));
|
||||||
.build());
|
License license = licenseMapper.toLicense(licenseDto);
|
||||||
assertThat(license).isNotNull();
|
assertThat(license).isNotNull();
|
||||||
assertThat(license.isRenewalRequired()).isTrue();
|
assertThat(license.isRenewalRequired()).isTrue();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue