TypeNotPresentExceptionProxy error when launching JUnit automation
When I launch a test with an automation JUnit (Selenium), it fails under specific conditions.
Working: If I launch using Maven Project without specifying a Test Class, it runs every test found in the project and this functions perfectly.
Failing: However, when I specify a test class (still using Maven Project), the test fails with an TypeNotPresentExceptionProxy error.
* Running without the Use Maven Project checkbox is not really viable, the classpath would be impossibly long.
Here is the stack trace:
1) initializationError(com.MyTestClass)
java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:715)
at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:522)
at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:348)
at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:283)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:117)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:70)
at java.lang.Class.initAnnotationsIfNecessary(Class.java:3271)
at java.lang.Class.initAnnotationsIfNecessary(Class.java:3278)
at java.lang.Class.initAnnotationsIfNecessary(Class.java:3278)
at java.lang.Class.getAnnotation(Class.java:3219)
at org.junit.internal.builders.IgnoredBuilder.runnerForClass(IgnoredBuilder.java:10)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
at org.junit.runner.Computer.getRunner(Computer.java:40)
at org.junit.runner.Computer$1.runnerForClass(Computer.java:31)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.runners.model.RunnerBuilder.runners(RunnerBuilder.java:101)
at org.junit.runners.model.RunnerBuilder.runners(RunnerBuilder.java:87)
at org.junit.runners.Suite.(Suite.java:80)
at org.junit.runner.Computer.getSuite(Computer.java:28)
at org.junit.runner.Request.classes(Request.java:75)
at org.junit.runner.JUnitCore.run(JUnitCore.java:117)
at org.junit.runner.JUnitCore.runMain(JUnitCore.java:96)
at org.junit.runner.JUnitCore.runMainAndExit(JUnitCore.java:47)
at org.junit.runner.JUnitCore.main(JUnitCore.java:40)
Information that might be useful:
- The project is local on the host.
- The projects normally builds as a war
- The project uses spring 4, with annotations and spring boot
- We use QA Complete 10
Looking over I found that this error is likely to occur when using annotions with specified classes as parameter on test classes.
I our case, our test class has the following annotations:
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = { TomcatApplication.class })
@WebAppConfiguration
@IntegrationTest({ "server.port:0", "spring.datasource.platform=fonc" })
@DirtiesContext
public class MyTestClass{
...
}
I cannot really change the use of these annotations in my project, so I would like to understand what can be done to have the test work with only one specified test class.