Skip to content

Commit 34f6ebe

Browse files
Merge pull request #3961 from michalberky/fix-randomly-failing-test
fix(core): fix randomly failing test
2 parents fbc9eaf + dba3212 commit 34f6ebe

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

perun-base/src/main/java/cz/metacentrum/perun/core/api/RichGroup.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,20 @@ public boolean equals(Object obj) {
112112
return false;
113113
}
114114
if (attributes == null) {
115-
if (other.getAttributes() != null) {
116-
return false;
117-
}
118-
} else if (!this.getAttributes().equals(other.getAttributes())) {
115+
return other.getAttributes() == null;
116+
}
117+
if (this.getAttributes().size() != other.getAttributes().size()) {
119118
return false;
120119
}
121-
return true;
120+
121+
List<Attribute> sortedThis = this.getAttributes().stream()
122+
.sorted()
123+
.toList();
124+
125+
List<Attribute> sortedOther = other.getAttributes().stream()
126+
.sorted()
127+
.toList();
128+
129+
return sortedThis.equals(sortedOther);
122130
}
123131
}

0 commit comments

Comments
 (0)