vlsi commented on PR #693: URL: https://github.com/apache/jmeter/pull/693#issuecomment-1296991750
The move from `HashMap` to `IdentityHashMap` in `HashTree` and `ListedHashTree` breaks two tests that check the behavior of `HashTree.equals`: ``` FAILURE 0,0sec, org.apache.jorphan.collections.PackageTest > testEqualsAndHashCode1() java.lang.AssertionError at org.junit.Assert.fail(Assert.java:87) at org.junit.Assert.assertTrue(Assert.java:42) at org.junit.Assert.assertTrue(Assert.java:53) at org.apache.jorphan.collections.PackageTest.testEqualsAndHashCode1(PackageTest.java:56) org.apache.jorphan.collections.PackageTest > testEqualsAndHashCode2() failure marker FAILURE 0,0sec, org.apache.jorphan.collections.PackageTest > testEqualsAndHashCode2() java.lang.AssertionError at org.junit.Assert.fail(Assert.java:87) at org.junit.Assert.assertTrue(Assert.java:42) at org.junit.Assert.assertTrue(Assert.java:53) at org.apache.jorphan.collections.PackageTest.testEqualsAndHashCode2(PackageTest.java:116) ``` The reason for test failure is that `IdentityHashMap.equals` uses reference equality for both keys and values, so `data.put(key, new HashTree());` in the default `HashTree` constructor generates "non-equal" `IdentityHashMap` objects since `new HashTree()` is different every time. I'm inclined the test should be corrected: remove the offending `.equals` comparison. @pmouawad , @FSchumacher , any thoughts? The root cause of the problem is that `TestElement` instances have no identity (e.g. they have no primary key), so they should not be put to `HashMap` keys. Unfortunately `HashTree` (and `ListedHashTree`) used to put test elements as keys of `HashMap` instances, which might produce wrong results when importing `.jmx`. `testfiles/BUG_62847.xml` is impacted by the bug if there's a hashcode collision. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@jmeter.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org