Skip to content

Commit

Permalink
fix: PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Kurt Janssen committed Apr 9, 2024
1 parent 43151f6 commit 233305f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public Builder locationName(String locationName) {
/**
* @deprecated data type OffsetDateTime has been replaced by LocalDate.
*/
@Deprecated(forRemoval=true)
public Builder date(OffsetDateTime date) {
return date(date.toLocalDate());
}
Expand All @@ -97,9 +98,9 @@ public Builder datum(OffsetDateTime date) {

public GeefSociaalStatuutRequest build() {
if(getInsz() == null) { throw new IllegalStateException("INSZ number must be given"); }
if(socialStatusName == null) { throw new IllegalStateException("SocialStatusName must be given"); }
if((date == null && startDate == null) || (date != null && startDate != null)) { throw new IllegalStateException("Date or StartDate must be given"); }
if(startDate == null && endDate != null) { throw new IllegalStateException("EndDate cannot be given without StartDate"); }
if(socialStatusName == null) { throw new IllegalStateException("socialStatusName must be given"); }
if((date == null && startDate == null) || (date != null && startDate != null)) { throw new IllegalStateException("Either date or startDate must be given"); }
if(startDate == null && endDate != null) { throw new IllegalStateException("endDate cannot be given without startDate"); }

return new GeefSociaalStatuutRequest(
getInsz(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void buildsRequestWithPeriod() {
void throwsException_whenInszNull() {
var builder = GeefSociaalStatuutRequest.builder()
.socialStatusName("sociaal-statuut")
.date(OffsetDateTime.now());
.date(LocalDate.now());

assertThrows(IllegalStateException.class, builder::build);
}
Expand All @@ -69,14 +69,14 @@ void throwsException_whenInszNull() {
void throwsException_whenSocialStatusNameNull() {
var builder = GeefSociaalStatuutRequest.builder()
.insz("insz")
.date(OffsetDateTime.now());
.date(LocalDate.now());

assertThrows(IllegalStateException.class, builder::build);
}

@Test
void locationNameIsOptional() {
var date = OffsetDateTime.now();
var date = LocalDate.now();

var request = GeefSociaalStatuutRequest.builder()
.insz("insz")
Expand Down Expand Up @@ -134,7 +134,7 @@ void setup() {
builder = GeefSociaalStatuutRequest.builder()
.insz("insz")
.socialStatusName("sociaal-statuut")
.date(OffsetDateTime.now());
.date(LocalDate.now());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.mockito.junit.jupiter.MockitoExtension;

import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import java.util.UUID;

Expand Down

0 comments on commit 233305f

Please sign in to comment.