java.lang.AssertionError

If you like a tip written by other Samebug users, mark is as helpful! Marks help our algorithm provide you better solutions and also help other users.
tip

Check your pattern declaration or check your assert declaration.


rafael

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • The entity integration tests automatically created by Roo are failing when run against a Database.com (VMFORCE) database. In this case, I'm using the Spring Petclinic script which includes this: entity --class ~.domain.Pet --testAutomatically entity --class ~.domain.Visit --testAutomatically entity --class ~.domain.AbstractPerson --abstract --mappedSuperclass entity --class ~.domain.Vet --extends ~.domain.AbstractPerson --testAutomatically entity --class ~.domain.Owner --extends ~.domain.AbstractPerson --testAutomatically When I run the integration tests, they fail with the following error: java.lang.AssertionError: Data on demand for 'Owner' failed to initialize correctly at org.junit.Assert.fail(Assert.java:91) at org.junit.Assert.assertTrue(Assert.java:43) at org.junit.Assert.assertNotNull(Assert.java:524) at com.springsource.petclinic.domain.OwnerIntegrationTest_Roo_IntegrationTest.ajc$interMethod$com_springsource_petclinic_domain_OwnerIntegrationTest_Roo_IntegrationTest$com_springsource_petclinic_domain_OwnerIntegrationTest$testCountOwners(OwnerIntegrationTest_Roo_IntegrationTest.aj:31) at com.springsource.petclinic.domain.OwnerIntegrationTest.testCountOwners(OwnerIntegrationTest.java:1) 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:616) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:236) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49) 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) In this case, the Database.com JPA implementation is an adaption of the Database.com SOAP API. This means that a persisted entity must be committed to the database before it can be found via find(). However, this does not appear to be how the entity integration tests were set up out of the box. What I've observed is that a transaction is created via the TransactionalTestExecutionListener, however, a commit is never executed after a persist (and probably rightfully so for most JPA setups). I'm not enough of a Spring expert to know what to do here. Basically, I want to commit the transaction and run a clean up afterwards. Can I do that with a custom test listener? I'd be happy to attempt a roo patch with some guidance here. Thanks.
    via by Tim Kral,
  • The entity integration tests automatically created by Roo are failing when run against a Database.com (VMFORCE) database. In this case, I'm using the Spring Petclinic script which includes this: entity --class ~.domain.Pet --testAutomatically entity --class ~.domain.Visit --testAutomatically entity --class ~.domain.AbstractPerson --abstract --mappedSuperclass entity --class ~.domain.Vet --extends ~.domain.AbstractPerson --testAutomatically entity --class ~.domain.Owner --extends ~.domain.AbstractPerson --testAutomatically When I run the integration tests, they fail with the following error: java.lang.AssertionError: Data on demand for 'Owner' failed to initialize correctly at org.junit.Assert.fail(Assert.java:91) at org.junit.Assert.assertTrue(Assert.java:43) at org.junit.Assert.assertNotNull(Assert.java:524) at com.springsource.petclinic.domain.OwnerIntegrationTest_Roo_IntegrationTest.ajc$interMethod$com_springsource_petclinic_domain_OwnerIntegrationTest_Roo_IntegrationTest$com_springsource_petclinic_domain_OwnerIntegrationTest$testCountOwners(OwnerIntegrationTest_Roo_IntegrationTest.aj:31) at com.springsource.petclinic.domain.OwnerIntegrationTest.testCountOwners(OwnerIntegrationTest.java:1) 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:616) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:236) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49) 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) In this case, the Database.com JPA implementation is an adaption of the Database.com SOAP API. This means that a persisted entity must be committed to the database before it can be found via find(). However, this does not appear to be how the entity integration tests were set up out of the box. What I've observed is that a transaction is created via the TransactionalTestExecutionListener, however, a commit is never executed after a persist (and probably rightfully so for most JPA setups). I'm not enough of a Spring expert to know what to do here. Basically, I want to commit the transaction and run a clean up afterwards. Can I do that with a custom test listener? I'd be happy to attempt a roo patch with some guidance here. Thanks.
    via by Tim Kral,
  • java tests fail
    via GitHub by btorpey
    ,
  • :aeron-driver:test FAILED
    via GitHub by maoxianfly
    ,
    • java.lang.AssertionError: Data on demand for 'Owner' failed to initialize correctly at org.junit.Assert.fail(Assert.java:91) at org.junit.Assert.assertTrue(Assert.java:43) at org.junit.Assert.assertNotNull(Assert.java:524) at com.springsource.petclinic.domain.OwnerIntegrationTest_Roo_IntegrationTest.ajc$interMethod$com_springsource_petclinic_domain_OwnerIntegrationTest_Roo_IntegrationTest$com_springsource_petclinic_domain_OwnerIntegrationTest$testCountOwners(OwnerIntegrationTest_Roo_IntegrationTest.aj:31) at com.springsource.petclinic.domain.OwnerIntegrationTest.testCountOwners(OwnerIntegrationTest.java:1) 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:616) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:236) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49) 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)

    Users with the same issue

    marcbouvierdav
    7 times, last one,
    jokester
    8 times, last one,
    pulse00
    1 times, last one,
    odd
    3 times, last one,
    andyglick
    2 times, last one,
    94 more bugmates