mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-07-30 19:41:24 +00:00
MonetaryFormat: Fix equals() and hashCode().
This commit is contained in:
committed by
Andreas Schildbach
parent
be40b7a3e5
commit
12f1670eea
@@ -489,7 +489,7 @@ public final class MonetaryFormat {
|
|||||||
return false;
|
return false;
|
||||||
if (!Objects.equals(this.roundingMode, other.roundingMode))
|
if (!Objects.equals(this.roundingMode, other.roundingMode))
|
||||||
return false;
|
return false;
|
||||||
if (!Objects.equals(this.codes, other.codes))
|
if (!Arrays.equals(this.codes, other.codes))
|
||||||
return false;
|
return false;
|
||||||
if (!Objects.equals(this.codeSeparator, other.codeSeparator))
|
if (!Objects.equals(this.codeSeparator, other.codeSeparator))
|
||||||
return false;
|
return false;
|
||||||
@@ -501,6 +501,6 @@ public final class MonetaryFormat {
|
|||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(negativeSign, positiveSign, zeroDigit, decimalMark, minDecimals, decimalGroups, shift,
|
return Objects.hash(negativeSign, positiveSign, zeroDigit, decimalMark, minDecimals, decimalGroups, shift,
|
||||||
roundingMode, codes, codeSeparator, codePrefixed);
|
roundingMode, Arrays.hashCode(codes), codeSeparator, codePrefixed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -352,4 +352,18 @@ public class MonetaryFormatTest {
|
|||||||
public void fiat() throws Exception {
|
public void fiat() throws Exception {
|
||||||
assertEquals(ONE_EURO, NO_CODE.parseFiat("EUR", "1"));
|
assertEquals(ONE_EURO, NO_CODE.parseFiat("EUR", "1"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEquals() {
|
||||||
|
MonetaryFormat mf1 = new MonetaryFormat(true);
|
||||||
|
MonetaryFormat mf2 = new MonetaryFormat(true);
|
||||||
|
assertEquals(mf1, mf2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testHashCode() {
|
||||||
|
MonetaryFormat mf1 = new MonetaryFormat(true);
|
||||||
|
MonetaryFormat mf2 = new MonetaryFormat(true);
|
||||||
|
assertEquals(mf1.hashCode(), mf2.hashCode());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user