Skip to content

Instantly share code, notes, and snippets.

@thomasdarimont
Created November 14, 2014 17:02
Show Gist options
  • Save thomasdarimont/59c5b9db94b0e44b8fee to your computer and use it in GitHub Desktop.
Save thomasdarimont/59c5b9db94b0e44b8fee to your computer and use it in GitHub Desktop.
java.lang.AssertionError: Redefined superclass:
[BasicQuery queryObject=com.mongodb.DBObject$$EnhancerByCGLIB$$5ceafab3@166fa74d fieldsObject=com.mongodb.DBObject$$EnhancerByCGLIB$$5ceafab3@166fa74d sortObject=com.mongodb.DBObject$$EnhancerByCGLIB$$5ceafab3@166fa74d RESTRICTED_TYPES_KEY=_$RESTRICTED_TYPES restrictedTypes=[red] criteria={red_key=red_value} fieldSpec=org.springframework.data.mongodb.core.query.Field@d1da1b74 sort=red skip=1 limit=1 hint=one meta=org.springframework.data.mongodb.core.query.Meta@1585e9f2]-throws AbstractMethodError(com.mongodb.DBObject$$EnhancerByCGLIB$$5ceafab3.keySet()Ljava/util/Set;)
should not equal superclass instance
[Query RESTRICTED_TYPES_KEY=_$RESTRICTED_TYPES restrictedTypes=[red] criteria={red_key=red_value} fieldSpec=org.springframework.data.mongodb.core.query.Field@d1da1b74 sort=red skip=1 limit=1 hint=one meta=org.springframework.data.mongodb.core.query.Meta@1585e9f2]-throws ClassCastException(java.lang.String cannot be cast to org.springframework.data.mongodb.core.query.CriteriaDefinition)
but it does.
For more information, go to: http://www.jqno.nl/equalsverifier/errormessages
at nl.jqno.equalsverifier.EqualsVerifier.handleError(EqualsVerifier.java:378)
at nl.jqno.equalsverifier.EqualsVerifier.verify(EqualsVerifier.java:361)
at org.springframework.data.mongodb.core.query.BasicQueryUnitTests.equalsContract(BasicQueryUnitTests.java:80)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
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.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:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
import org.springframework.data.mongodb.core.query.BasicQuery;
import com.mongodb.BasicDBObject;
/**
* @see DATAMONGO-1093
*/
@Test
public void equalsContract() {
BasicQuery query1 = new BasicQuery("{ \"name\" : \"Thomas\"}", "{\"name\":1, \"age\":1}");
query1.setSortObject(new BasicDBObject("name", -1));
BasicQuery query2 = new BasicQuery("{ \"name\" : \"Oliver\"}", "{\"name\":1, \"address\":1}");
query2.setSortObject(new BasicDBObject("name", 1));
EqualsVerifier.forExamples(query1, query2) //
.withRedefinedSuperclass() //
.suppress(Warning.NONFINAL_FIELDS, Warning.NULL_FIELDS) //
.verify();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment