1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-12-07 21:01:16 +01:00

Simplify UserIdTests

This commit is contained in:
Paul Schaub 2022-11-30 15:41:53 +01:00
parent 4c1d359971
commit 837fbd3635
2 changed files with 3 additions and 36 deletions

View file

@ -22,20 +22,17 @@ public final class UserId implements CharSequence {
this.email = email;
}
public Builder withName(String name) {
checkNotNull("name", name);
public Builder withName(@Nonnull String name) {
this.name = name;
return this;
}
public Builder withComment(String comment) {
checkNotNull("comment", comment);
public Builder withComment(@Nonnull String comment) {
this.comment = comment;
return this;
}
public Builder withEmail(String email) {
checkNotNull("email", email);
public Builder withEmail(@Nonnull String email) {
this.email = email;
return this;
}
@ -72,13 +69,10 @@ public final class UserId implements CharSequence {
}
public static UserId onlyEmail(@Nonnull String email) {
checkNotNull("email", email);
return new UserId(null, null, email);
}
public static UserId nameAndEmail(@Nonnull String name, @Nonnull String email) {
checkNotNull("name", name);
checkNotNull("email", email);
return new UserId(name, null, email);
}
@ -180,10 +174,4 @@ public final class UserId implements CharSequence {
|| (!valueIsNull && !otherValueIsNull
&& (ignoreCase ? value.equalsIgnoreCase(otherValue) : value.equals(otherValue)));
}
private static void checkNotNull(String paramName, String value) {
if (value == null) {
throw new IllegalArgumentException(paramName + " must be not null");
}
}
}