You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What steps will reproduce the problem?
1. write a class that references a java.util.BitSet
2. write/generate hashCode equals methods for that class
3. run equalsverifier
4. you get an ArrayIndexOutOfBoundsException:1 at BitSet.java:1024 with a stack
trace similar to the following:
java.lang.AssertionError: java.lang.ArrayIndexOutOfBoundsException: 1
For more information, go to: http://www.jqno.nl/equalsverifier/errormessages
at nl.jqno.equalsverifier.EqualsVerifier.handleError(EqualsVerifier.java:347)
at nl.jqno.equalsverifier.EqualsVerifier.verify(EqualsVerifier.java:333)
at com.emovimento.stock.commons.bom.recommendations.RecommendationsTest.equalsContract(RecommendationsTest.java:32)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
at java.util.BitSet.hashCode(BitSet.java:1024)
at com.emovimento.stock.commons.bom.recommendations.Recommendations.hashCode(Recommendations.java:86)
at nl.jqno.equalsverifier.ExamplesChecker.checkHashCode(ExamplesChecker.java:187)
at nl.jqno.equalsverifier.ExamplesChecker.checkSingle(ExamplesChecker.java:92)
at nl.jqno.equalsverifier.ExamplesChecker.check(ExamplesChecker.java:67)
at nl.jqno.equalsverifier.EqualsVerifier.verifyWithExamples(EqualsVerifier.java:385)
at nl.jqno.equalsverifier.EqualsVerifier.performVerification(EqualsVerifier.java:356)
at nl.jqno.equalsverifier.EqualsVerifier.verify(EqualsVerifier.java:327)
... 25 more
Original issue reported on code.google.com by [email protected] on 4 Oct 2013 at 10:54
The text was updated successfully, but these errors were encountered:
Nice catch, thanks for reporting this! I will fix this in the next release.
In the mean time, you can use the following workaround:
BitSet red = BitSet.valueOf(new byte[] {0, 0});
BitSet black = BitSet.valueOf(new byte[] {1, 1});
EqualsVerifier.forClass(BitSetContainer.class)
.withPrefabValues(BitSet.class, red, black)
.verify();
Regards,
Jan
Original issue reported on code.google.com by
[email protected]
on 4 Oct 2013 at 10:54The text was updated successfully, but these errors were encountered: