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.

  • h4. Overview Building with Maven under Java 6, the {{testAdvisorAdapterRegistrationManagerNotPresentInContext()}} method in {{AdvisorAdapterRegistrationTests}} consistently passes. Building under Java 7 (e.g., JDK 1.7.0_06), it sometimes passes but most of the time throws the error detailed below. The failure is due to the test *running* under Java 7 and has nothing to do with the compilation. h4. Steps to recreate Please note that to recreate the issue you *must* run at least both the tests in {{AdvisorAdapterRegistrationTests}} *together*. The problem has something to do with the interaction between the two tests. If you just run the {{testAdvisorAdapterRegistrationManagerNotPresentInContext()}} method on its own (in Eclipse) then it'll pass every time. * In Eclipse select the {{AdvisorAdapterRegistrationTests}} class and say "run as JUnit test". You'll see it succeed. * Go to the _Run Configuration_ menu and under the JRE tab select an Alternate JRE of a Java 7 runtime. * Repeat the run using your updated run configuration. You'll see a test failure. * If you run it 10 times, you'll probably see it succeed one or two times. h4. ERROR Details {noformat} java.lang.AssertionError: Should throw UnknownAdviceTypeException at org.junit.Assert.fail(Assert.java:93) at org.springframework.aop.framework.adapter.AdvisorAdapterRegistrationTests.testAdvisorAdapterRegistrationManagerNotPresentInContext(AdvisorAdapterRegistrationTests.java:49) 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:601) 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.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:69) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:48) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.junit.runners.ParentRunner.run(ParentRunner.java:292) 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) {noformat}
    via by David Boden,
  • h4. Overview Building with Maven under Java 6, the {{testAdvisorAdapterRegistrationManagerNotPresentInContext()}} method in {{AdvisorAdapterRegistrationTests}} consistently passes. Building under Java 7 (e.g., JDK 1.7.0_06), it sometimes passes but most of the time throws the error detailed below. The failure is due to the test *running* under Java 7 and has nothing to do with the compilation. h4. Steps to recreate Please note that to recreate the issue you *must* run at least both the tests in {{AdvisorAdapterRegistrationTests}} *together*. The problem has something to do with the interaction between the two tests. If you just run the {{testAdvisorAdapterRegistrationManagerNotPresentInContext()}} method on its own (in Eclipse) then it'll pass every time. * In Eclipse select the {{AdvisorAdapterRegistrationTests}} class and say "run as JUnit test". You'll see it succeed. * Go to the _Run Configuration_ menu and under the JRE tab select an Alternate JRE of a Java 7 runtime. * Repeat the run using your updated run configuration. You'll see a test failure. * If you run it 10 times, you'll probably see it succeed one or two times. h4. ERROR Details {noformat} java.lang.AssertionError: Should throw UnknownAdviceTypeException at org.junit.Assert.fail(Assert.java:93) at org.springframework.aop.framework.adapter.AdvisorAdapterRegistrationTests.testAdvisorAdapterRegistrationManagerNotPresentInContext(AdvisorAdapterRegistrationTests.java:49) 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:601) 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.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:69) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:48) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.junit.runners.ParentRunner.run(ParentRunner.java:292) 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) {noformat}
    via by David Boden,
  • Flaky unit tests
    via GitHub by samuelgruetter
    ,
    • java.lang.AssertionError: Should throw UnknownAdviceTypeException at org.junit.Assert.fail(Assert.java:93) at org.springframework.aop.framework.adapter.AdvisorAdapterRegistrationTests.testAdvisorAdapterRegistrationManagerNotPresentInContext(AdvisorAdapterRegistrationTests.java:49) 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:601) 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.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:69) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:48) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.junit.runners.ParentRunner.run(ParentRunner.java:292) 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)

    Users with the same issue

    Andreas Häber
    8 times, last one,
    osvzs
    2 times, last one,
    Casper
    2 times, last one,
    marcbouvierdav
    1 times, last one,
    rsprangemeijer
    1 times, last one,
    94 more bugmates