Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Trivial
-
Resolution: Fixed
-
Affects Version/s: 2.2.5 (EE only)
-
Fix Version/s: 2.2.6 (EE only)
-
Component/s: Build: Integration Tests, Core: Routing / Filters
-
Labels:None
-
User impact:Low
-
Similar Issues:None
Description
The test EventGroupTestCase.testCompareTo() fails intermittently because it depends on the fact that some time passes between the creation of one object and the next.
This is the affected code:
// when the groupId is not Comparable, the creation time is used as fallback g1 = new EventGroup(new Object()); g2 = new EventGroup(new Object()); // g1 is older (smaller) than g2 assertTrue(g1.compareTo(g2) < 0); assertTrue(g2.compareTo(g1) > 0);
In order for the assertions to pass, there must be at least one nanosecond between the creation of g1 and g2. Sometimes this is not the case so the test fails. I suggest inserting a Thread.yield() call in the middle of the two cretions, like this:
// when the groupId is not Comparable, the creation time is used as fallback g1 = new EventGroup(new Object()); Thread.yield(); // this makes sure that there is a time difference between // the two EventGroup creations. g2 = new EventGroup(new Object()); // g1 is older (smaller) than g2 assertTrue(g1.compareTo(g2) < 0); assertTrue(g2.compareTo(g1) > 0);
Issue Links
- relates to
-
MULE-4592
EventGroup does not work with IBM JDK
-