File tree Expand file tree Collapse file tree
main/java/org/apache/commons/io/file
test/java/org/apache/commons/io/file Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -116,11 +116,11 @@ public boolean equals(Object obj) {
116116 if (this == obj ) {
117117 return true ;
118118 }
119- if (!(obj instanceof BigIntegerCounter )) {
119+ if (!(obj instanceof Counter )) {
120120 return false ;
121121 }
122- BigIntegerCounter other = (BigIntegerCounter ) obj ;
123- return Objects .equals (value , other .value );
122+ Counter other = (Counter ) obj ;
123+ return Objects .equals (value , other .getBigInteger () );
124124 }
125125
126126 @ Override
@@ -226,11 +226,11 @@ public boolean equals(Object obj) {
226226 if (this == obj ) {
227227 return true ;
228228 }
229- if (!(obj instanceof LongCounter )) {
229+ if (!(obj instanceof Counter )) {
230230 return false ;
231231 }
232- LongCounter other = (LongCounter ) obj ;
233- return value == other .value ;
232+ Counter other = (Counter ) obj ;
233+ return value == other .get () ;
234234 }
235235
236236 @ Override
Original file line number Diff line number Diff line change @@ -87,6 +87,12 @@ public void testLongCounterEquals() {
8787 testEquals (Counters .longCounter (), Counters .longCounter ());
8888 }
8989
90+ @ Test
91+ public void testLongCounterMixEquals () {
92+ testEquals (Counters .longCounter (), Counters .bigIntegerCounter ());
93+ testEquals (Counters .bigIntegerCounter (), Counters .longCounter ());
94+ }
95+
9096 @ Test
9197 public void testLongCounterHashCodes () {
9298 testHashCodes (Counters .longCounter (), Counters .longCounter ());
@@ -111,4 +117,9 @@ public void testLongPathCountersEqualsFileCounters() {
111117 public void testLongPathCountersHashCodeFileCounters () {
112118 testHashCodeFileCounters (Counters .longPathCounters (), Counters .longPathCounters ());
113119 }
120+
121+ @ Test
122+ public void testMix () {
123+ testHashCodeFileCounters (Counters .longPathCounters (), Counters .bigIntegerPathCounters ());
124+ }
114125}
You can’t perform that action at this time.
0 commit comments