Skip to content

Commit

Permalink
Polish equals() implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
marcphilipp committed May 31, 2023
1 parent fce3847 commit 724f5f3
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/main/java/org/opentest4j/FileInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,15 @@ public String getContentsAsString(Charset charset) {
* with the same path and contents as this {@code FileInfo}.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (o == null || getClass() != o.getClass()) {
if (obj == null || getClass() != obj.getClass()) {
return false;
}

FileInfo fileInfo = (FileInfo) o;

if (!Arrays.equals(contents, fileInfo.contents)) {
return false;
}
return path.equals(fileInfo.path);
FileInfo that = (FileInfo) obj;
return this.path.equals(that.path) && Arrays.equals(this.contents, that.contents);
}

/**
Expand Down

0 comments on commit 724f5f3

Please sign in to comment.