Hi,
I want to perform integration test with JUnit. My test class inherits from ESIntegTestCase. But I also want my test resolves Spring bean.
For my first try, I used the SpringJUnit4ClassRunner but it failed, as the Spring Runner overrides the RandomizedRunner from Elasticsearch. Then I tried to add the two following attributes, that can be used to run Spring test without using the SpringRunner:
@ClassRule
public static final SpringClassRule SPRING_CLASS_RULE = new SpringClassRule();
@Rule
public final SpringMethodRule springMethodRule = new SpringMethodRule();
However, I get the following exception:
SEVERE: Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@2fb9ec94] to prepare test instance [TestDAL@1b416347]
java.lang.IllegalStateException: Failed to load ApplicationContext
...
Caused by: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessDeclaredMembers")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
at java.security.AccessController.checkPermission(AccessController.java:884)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
If I remove the "extends ESIntegTestCase", it works: but of course, it is not what I am looking for.
Do you know how to combine EsIntegTestCase with another Runner, such as the Spring Runner to perform integration test of ES in a project that uses the Spring Framework?
Thank you,