You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@fineract.apache.org by "Michael Vorburger (Jira)" <ji...@apache.org> on 2020/01/12 14:25:00 UTC
[jira] [Commented] (FINERACT-827) ShareAccountCharge is missing
hashCode() & equals() but adding it fails ShareAccountIntegrationTests
[ https://issues.apache.org/jira/browse/FINERACT-827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17013775#comment-17013775 ]
Michael Vorburger commented on FINERACT-827:
--------------------------------------------
For full history of what's what and how we got to this:
1. Awasum in his work on FINERACT-702 saw that SpotBugs pointed out, absolutely correctly, that {{ShareAccountCharge}} originally had only an {{equals()}} method but no {{hashCode()}}, which is always a clear bug (no discussion here). Awasum thus, as a first step, removed that {{equals()}}, which was merged in https://github.com/apache/fineract/pull/682.
2. Michael followed up on that trying to fix it correctly, together with some other {{equals()}} / {{hashCode()}} changes, in https://github.com/apache/fineract/pull/684, by adding both {{equals()}} / {{hashCode()}} to {{ShareAccountCharge}}. This failed {{ShareAccountIntegrationTests}}'s {{testCreateShareAccountWithCharges()}} in line 487 {{Assert.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding")));}} with a {{org.junit.ComparisonFailure: expected:<[0].0> but was:<[2].0>}}. The {{equals()}} / {{hashCode()}} was implemented using Commons Lang EqualsBuilder and HashCodeBuilder (instead of Objects.hash() and Objects.equals(), which should not matter...), and using all fields, not using {{getId()}} for {{@ManyToOne}} fields {{ShareAccount}} and {{Charge}}
> ShareAccountCharge is missing hashCode() & equals() but adding it fails ShareAccountIntegrationTests
> ----------------------------------------------------------------------------------------------------
>
> Key: FINERACT-827
> URL: https://issues.apache.org/jira/browse/FINERACT-827
> Project: Apache Fineract
> Issue Type: Bug
> Reporter: Michael Vorburger
> Priority: Blocker
>
> During work in FINERACT-702 (specifically during [pull/684|https://github.com/apache/fineract/pull/684]), we've stumbled upon {{ShareAccountCharge}} missing required {{hashCode()}} & {{equals()}} methods, but found that adding them fails the {{ShareAccountIntegrationTests}}.
> This is likely an indication of a major bug worth further investigating.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)