-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
I'm trying to use the Spring Junit Rules (SpringClassRule and SpringMethodRule) with the NestedRunner, but I'm getting a NullPointerException at the start of the tests.
Here is a minimal example :
@RunWith(NestedRunner.class)
@SpringApplicationConfiguration(value=ExampleContext.class)
public class TestTest {
@ClassRule
public static final SpringClassRule springClassRule = new SpringClassRule();
@Rule
public final SpringMethodRule springMethodRule = new SpringMethodRule();
@Test
public void firstTest() {
org.junit.Assert.assertTrue(true);
}
}
@Configuration
class ExampleContext {
}
and the error :
java.lang.NullPointerException
at org.springframework.test.context.junit4.rules.SpringClassRule.apply(SpringClassRule.java:140)
at org.junit.rules.RunRules.applyAll(RunRules.java:26)
at org.junit.rules.RunRules.<init>(RunRules.java:15)
at org.junit.runners.ParentRunner.withClassRules(ParentRunner.java:245)
at org.junit.runners.ParentRunner.classBlock(ParentRunner.java:194)
at org.junit.runners.ParentRunner.run(ParentRunner.java:362)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
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)
If I comment out the @RunWith annotation, then it works fine.
Metadata
Metadata
Assignees
Labels
No labels