Skip to content

Commit

Permalink
Simplify equality checks using Objects.equals in PostConstructAdapter…
Browse files Browse the repository at this point in the history
…FactoryTest (#2767)
  • Loading branch information
panic08 authored Oct 21, 2024
1 parent 3e5ccb1 commit 44c9336
Showing 1 changed file with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.google.gson.GsonBuilder;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import javax.annotation.PostConstruct;
import org.junit.Test;

Expand Down Expand Up @@ -89,13 +90,8 @@ public boolean equals(Object o) {
return false;
}
Sandwich other = (Sandwich) o;
if (this.bread == null ? other.bread != null : !this.bread.equals(other.bread)) {
return false;
}
if (this.cheese == null ? other.cheese != null : !this.cheese.equals(other.cheese)) {
return false;
}
return true;

return Objects.equals(this.bread, other.bread) && Objects.equals(this.cheese, other.cheese);
}
}

Expand All @@ -116,12 +112,8 @@ public boolean equals(Object o) {
return false;
}
MultipleSandwiches other = (MultipleSandwiches) o;
if (this.sandwiches == null
? other.sandwiches != null
: !this.sandwiches.equals(other.sandwiches)) {
return false;
}
return true;

return Objects.equals(this.sandwiches, other.sandwiches);
}
}
}

0 comments on commit 44c9336

Please sign in to comment.