Open mmlinford opened 8 years ago
So there are two files here: TestScript and DiNode. Fixed TestScript in #35, however, when tried to override hashCode in DiNode tests failed. One of the failed tests is: RandomGeneratorTest - all tests fail
When the setup() runs, the call: testAgenda.getTestScripts()
returns an empty list - and so, none of the tests get initialized, throwing a NullPointerException later.
So here's the reason: DiGraph.hashCode is being called due to the call of TestDigraph#addVertex . A call to hashCode should necessitate DiGraph be an immutable class. The case here, is that DiGraph is a mutable class since the testScript is stored as a reference from the called testScript in the constructor and not copied. That means that the caller can still modify the testScript and so the old hashes will fail.
The below locations (class:line number) violate the OverrideBothEqualsAndHashcode rule:
org.finra.jtaf.core.model.test.TestScript:199 org.finra.jtaf.core.model.test.digraph.DiNode:46 org.finra.jtaf.core.model.test.TestScript:199 org.finra.jtaf.core.model.test.digraph.DiNode:46