Skip to content

Commit

Permalink
Validate userId in domain layer
Browse files Browse the repository at this point in the history
  • Loading branch information
leung018 committed Dec 20, 2024
1 parent 50a4214 commit 0e937e8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public Builder toBuilder() {
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
private String id;

private String userId;
@NotBlank private String userId;

@NotBlank private String name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ void shouldRaiseExceptionWhenBuild_IfParamsViolateTheValidationConstraints() {

assertThrowValidationException(productBuilder().name(""));
assertThrowValidationException(productBuilder().name(null));

assertThrowValidationException(productBuilder().userId(""));
assertThrowValidationException(productBuilder().userId(null));
}

private void assertThrowValidationException(Product.Builder builder) {
Expand Down

0 comments on commit 0e937e8

Please sign in to comment.