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
If a test method invokes code that throws AssertionError (that is, not the test method itself, but the code it is exercising) then JUnit replaces it with an AssertionFailedError exception that does not include the "cause" of the original exception. I need this information to track the problem to its source!
Here is an example of what I get from JUnit:
Testcase: insertDependency(org.pill.repository.local.LocalRepositoryTest): FAILED
java.lang.ClassCastException: java.lang.Byte cannot be cast to java.lang.String
junit.framework.AssertionFailedError: java.lang.ClassCastException: java.lang.Byte cannot be cast to java.lang.String
at org.pill.repository.local.LocalRepository.insertRelease(LocalRepository.java:256)
at org.pill.ReleaseBuilder.build(ReleaseBuilder.java:83)
at org.pill.repository.local.LocalRepositoryTest.insertDependency(LocalRepositoryTest.java:161)
Here is what I get if I explicitly catch the AssertionError and printStackTrace() in my test method:
java.lang.AssertionError: java.lang.ClassCastException: java.lang.Byte cannot be cast to java.lang.String
at org.pill.repository.local.LocalRepository.insertRelease(LocalRepository.java:256)
at org.pill.ReleaseBuilder.build(ReleaseBuilder.java:83)
at org.pill.repository.local.LocalRepositoryTest.insertDependency(LocalRepositoryTest.java:164)
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:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
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:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
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.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:518)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1052)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:906)
Caused by: java.lang.ClassCastException: java.lang.Byte cannot be cast to java.lang.String
at org.pill.repository.local.LocalRepository.getRelease(LocalRepository.java:782)
at org.pill.repository.local.LocalRepository.access$500(LocalRepository.java:44)
at org.pill.repository.local.LocalRepository$InsertRelease.call(LocalRepository.java:375)
at org.pill.repository.local.LocalRepository$InsertRelease.call(LocalRepository.java:263)
at org.pill.repository.local.RequestInjector$1.call(RequestInjector.java:50)
at com.google.inject.servlet.ServletScopes$4.call(ServletScopes.java:251)
at org.pill.repository.local.LocalRepository.insertRelease(LocalRepository.java:233)
... 25 more
The text was updated successfully, but these errors were encountered:
Sorry for the age of this request. This appears to be a situation where ant is trying to run a JUnit 4 test as if it were a JUnit 3 test. Are you still having this problem?
I am using JUnit 4.10.
If a test method invokes code that throws AssertionError (that is, not the test method itself, but the code it is exercising) then JUnit replaces it with an AssertionFailedError exception that does not include the "cause" of the original exception. I need this information to track the problem to its source!
Here is an example of what I get from JUnit:
Testcase: insertDependency(org.pill.repository.local.LocalRepositoryTest): FAILED
java.lang.ClassCastException: java.lang.Byte cannot be cast to java.lang.String
junit.framework.AssertionFailedError: java.lang.ClassCastException: java.lang.Byte cannot be cast to java.lang.String
at org.pill.repository.local.LocalRepository.insertRelease(LocalRepository.java:256)
at org.pill.ReleaseBuilder.build(ReleaseBuilder.java:83)
at org.pill.repository.local.LocalRepositoryTest.insertDependency(LocalRepositoryTest.java:161)
Here is what I get if I explicitly catch the AssertionError and printStackTrace() in my test method:
java.lang.AssertionError: java.lang.ClassCastException: java.lang.Byte cannot be cast to java.lang.String
at org.pill.repository.local.LocalRepository.insertRelease(LocalRepository.java:256)
at org.pill.ReleaseBuilder.build(ReleaseBuilder.java:83)
at org.pill.repository.local.LocalRepositoryTest.insertDependency(LocalRepositoryTest.java:164)
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:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
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:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
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.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:518)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1052)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:906)
Caused by: java.lang.ClassCastException: java.lang.Byte cannot be cast to java.lang.String
at org.pill.repository.local.LocalRepository.getRelease(LocalRepository.java:782)
at org.pill.repository.local.LocalRepository.access$500(LocalRepository.java:44)
at org.pill.repository.local.LocalRepository$InsertRelease.call(LocalRepository.java:375)
at org.pill.repository.local.LocalRepository$InsertRelease.call(LocalRepository.java:263)
at org.pill.repository.local.RequestInjector$1.call(RequestInjector.java:50)
at com.google.inject.servlet.ServletScopes$4.call(ServletScopes.java:251)
at org.pill.repository.local.LocalRepository.insertRelease(LocalRepository.java:233)
... 25 more
The text was updated successfully, but these errors were encountered: