File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
main/java/org/javamoney/moneta/function
test/java/org/javamoney/moneta/function Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -134,6 +134,23 @@ public MonetaryAmount getAverage() {
134134 return average ;
135135 }
136136
137+ /**
138+ * will equals when the currency utils were equals
139+ */
140+ @ Override
141+ public boolean equals (Object obj ) {
142+ if (MonetarySummaryStatistics .class .isInstance (obj )) {
143+ MonetarySummaryStatistics other = MonetarySummaryStatistics .class .cast (obj );
144+ return Objects .equals (empty .getCurrency (),
145+ other .empty .getCurrency ());
146+ }
147+ return false ;
148+ }
149+ @ Override
150+ public int hashCode () {
151+ return empty .getCurrency ().hashCode ();
152+ }
153+
137154 @ Override
138155 public String toString () {
139156 StringBuilder sb = new StringBuilder ();
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ public void shouldStayEmptyWhenIsDifferentCurrency() {
4040 Assert .assertEquals (0L , summary .getMin ().getNumber ().longValue ());
4141 Assert .assertEquals (0L , summary .getMax ().getNumber ().longValue ());
4242 Assert .assertEquals (0L , summary .getSum ().getNumber ().longValue ());
43- Assert .assertEquals (0L , summary .getAvarage ().getNumber ().longValue ());
43+ Assert .assertEquals (0L , summary .getAverage ().getNumber ().longValue ());
4444 }
4545
4646 @ Test
@@ -86,7 +86,7 @@ public void shouldIgnoreCombineWhenCurrencyInSummaryAreDifferent() {
8686 Assert .assertEquals (10L , summaryA .getMin ().getNumber ().longValue ());
8787 Assert .assertEquals (110L , summaryA .getMax ().getNumber ().longValue ());
8888 Assert .assertEquals (210L , summaryA .getSum ().getNumber ().longValue ());
89- Assert .assertEquals (70L , summaryA .getAvarage ().getNumber ().longValue ());
89+ Assert .assertEquals (70L , summaryA .getAverage ().getNumber ().longValue ());
9090 }
9191
9292 private MonetarySummaryStatistics createSummary (CurrencyUnit currencyUnit ) {
You can’t perform that action at this time.
0 commit comments