Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed build failure due to suboptimal expression in newly added tests
  • Loading branch information
pushkar committed Jul 6, 2025
commit e35bf2b9debed91e576ea8efecb79a187ac79914
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,14 @@ public int compareTo(Person o) {

@Override
public boolean equals(Object o) {
if (!(o instanceof Person)) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Person p = (Person) o;
return this.name.equals(p.name) && this.age == p.age;
Person person = (Person) o;
return age == person.age && Objects.equals(name, person.name);
}

@Override
Expand Down
9 changes: 6 additions & 3 deletions src/test/java/com/thealgorithms/sorts/BogoSortTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,14 @@ public int compareTo(Person o) {

@Override
public boolean equals(Object o) {
if (!(o instanceof Person)) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Person p = (Person) o;
return this.name.equals(p.name) && this.age == p.age;
Person person = (Person) o;
return age == person.age && Objects.equals(name, person.name);
}

@Override
Expand Down
9 changes: 6 additions & 3 deletions src/test/java/com/thealgorithms/sorts/BubbleSortTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,14 @@ public int compareTo(Person o) {

@Override
public boolean equals(Object o) {
if (!(o instanceof Person)) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Person p = (Person) o;
return this.name.equals(p.name) && this.age == p.age;
Person person = (Person) o;
return age == person.age && Objects.equals(name, person.name);
}

@Override
Expand Down
9 changes: 6 additions & 3 deletions src/test/java/com/thealgorithms/sorts/GnomeSortTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,14 @@ public int compareTo(Person o) {

@Override
public boolean equals(Object o) {
if (!(o instanceof Person)) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Person p = (Person) o;
return this.name.equals(p.name) && this.age == p.age;
Person person = (Person) o;
return age == person.age && Objects.equals(name, person.name);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,14 @@ public int compareTo(Person o) {

@Override
public boolean equals(Object o) {
if (!(o instanceof Person)) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Person p = (Person) o;
return this.name.equals(p.name) && this.age == p.age;
Person person = (Person) o;
return age == person.age && Objects.equals(name, person.name);
}

@Override
Expand Down
9 changes: 6 additions & 3 deletions src/test/java/com/thealgorithms/sorts/SlowSortTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,14 @@ public int compareTo(Person o) {

@Override
public boolean equals(Object o) {
if (!(o instanceof Person)) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Person p = (Person) o;
return this.name.equals(p.name) && this.age == p.age;
Person person = (Person) o;
return age == person.age && Objects.equals(name, person.name);
}

@Override
Expand Down
Loading