Skip to content

Commit

Permalink
minor update
Browse files Browse the repository at this point in the history
  • Loading branch information
jabrena committed May 31, 2024
1 parent 37e5662 commit 450df4d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public String getMessage() {
//Either<AgeProblem, Age> problem2 = Either.left(new NotLegalAdult());
//Either<AgeProblem, Age> success = Either.right(new Age(20));

public Either<AgeProblem, Age> validAdultAge(Integer age) {
public Either<AgeProblem, Age> validateAge(Integer age) {
return switch (age) {
case Integer a when a < 0 -> Either.left(new InvalidAge());
case Integer a when a < 18 -> Either.left(new NotLegalAdult());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ public void should_notValidate() {

AgeProblemExample example = new AgeProblemExample();

var result = example.validAdultAge(-1);
var result = example.validateAge(-1);

assertThat(result).isInstanceOf(Either.class);
assertThat(result.isLeft()).isTrue();

var result2 = example.validAdultAge(17);
var result2 = example.validateAge(17);
assertThat(result2).isInstanceOf(Either.class);
assertThat(result2.isLeft()).isTrue();

Expand All @@ -45,7 +45,7 @@ public void should_validate() {

AgeProblemExample example = new AgeProblemExample();

var result = example.validAdultAge(18);
var result = example.validateAge(18);

assertThat(result).isInstanceOf(Either.class);
assertThat(result.isRight()).isTrue();
Expand Down

0 comments on commit 450df4d

Please sign in to comment.