Skip to content

Commit

Permalink
Make verdict part of hash code.
Browse files Browse the repository at this point in the history
  • Loading branch information
dkocher committed Oct 10, 2023
1 parent 5318a73 commit 4440532
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/src/main/java/ch/cyberduck/core/PathAttributes.java
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,9 @@ public boolean equals(final Object o) {
if(!Objects.equals(revision, that.revision)) {
return false;
}
if(!Objects.equals(verdict, that.verdict)) {
return false;
}
return true;
}

Expand All @@ -687,6 +690,7 @@ public int hashCode() {
result = 31 * result + (versionId != null ? versionId.hashCode() : 0);
result = 31 * result + (fileId != null ? fileId.hashCode() : 0);
result = 31 * result + (revision != null ? revision.hashCode() : 0);
result = 31 * result + (verdict != null ? verdict.hashCode() : 0);
return result;
}

Expand Down Expand Up @@ -714,6 +718,7 @@ public String toString() {
sb.append(", region='").append(region).append('\'');
sb.append(", metadata=").append(metadata).append('\'');
sb.append(", custom=").append(custom).append('\'');
sb.append(", verdict=").append(verdict).append('\'');
sb.append('}');
return sb.toString();
}
Expand Down
3 changes: 3 additions & 0 deletions core/src/test/java/ch/cyberduck/core/PathAttributesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public void testCopy() {
attributes.setDuplicate(true);
attributes.setLockId(new AlphanumericRandomStringService().random());
attributes.setPermission(new Permission(644));
attributes.setVerdict(PathAttributes.Verdict.pending);
final PathAttributes clone = new PathAttributes(attributes);
assertEquals(clone.getPermission(), attributes.getPermission());
assertEquals(clone.getModificationDate(), attributes.getModificationDate());
Expand Down Expand Up @@ -79,6 +80,7 @@ public void testSerialize() {
attributes.setDuplicate(true);
attributes.setRegion("region");
attributes.setStorageClass("storageClass");
attributes.setVerdict(PathAttributes.Verdict.pending);
final Map<String, String> custom = new HashMap<>(attributes.getCustom());
custom.put("key", "value");
attributes.setCustom(custom);
Expand All @@ -93,6 +95,7 @@ public void testSerialize() {
assertEquals(attributes.isDuplicate(), deserialized.isDuplicate());
assertEquals(attributes.getRegion(), deserialized.getRegion());
assertEquals(attributes.getStorageClass(), deserialized.getStorageClass());
assertEquals(attributes.getVerdict(), deserialized.getVerdict());
assertEquals(attributes.getCustom(), deserialized.getCustom());
assertEquals(attributes, deserialized);
}
Expand Down

0 comments on commit 4440532

Please sign in to comment.