# Elasticsearch (Java) - Integration tests

**URL:** <https://discuss.elastic.co/t/elasticsearch-java-integration-tests/123750>\
**Category:** Elasticsearch\
**Created:** [March 13, 2018, 2:24pm UTC](https://discuss.elastic.co/t/elasticsearch-java-integration-tests/123750 "2018-03-13T14:24:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nikita\_Krasnov](https://avatars.discourse-cdn.com/v4/letter/n/53a042/32.png) [@Nikita\_Krasnov](https://discuss.elastic.co/u/Nikita_Krasnov)\
**Post date:** [March 13, 2018, 2:24pm UTC](https://discuss.elastic.co/t/elasticsearch-java-integration-tests/123750/1 "2018-03-13T14:24:46Z")

</div>

I use Java 8, Elasticsearch High level client 6.1.1 and Maven and want to write some integration tests.  
Here my java class for tests:

```
@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.SUITE, numDataNodes=1)
public class ElasticSearchServiceITest extends ESIntegTestCase {
}

```

I have added dependencies:

```
<dependency>
            <groupId>org.elasticsearch.test</groupId>
            <artifactId>framework</artifactId>
            <version>6.1.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.lucene</groupId>
            <artifactId>lucene-test-framework</artifactId>
            <version>7.1.0</version>
            <scope>test</scope>
        </dependency>

```

When I try to run my test - I see cuch errors:

```
java.lang.RuntimeException: found jar hell in test classpath

	at org.elasticsearch.bootstrap.BootstrapForTesting.<clinit>(BootstrapForTesting.java:92)
	at org.elasticsearch.test.ESTestCase.<clinit>(ESTestCase.java:190)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:348)
	at com.carrotsearch.randomizedtesting.RandomizedRunner$2.run(RandomizedRunner.java:592)
Caused by: java.lang.IllegalStateException: jar hell!

Exception in thread "Thread-6" java.lang.NoClassDefFoundError: Could not initialize class org.elasticsearch.test.ESTestCase
	at java.lang.Thread.run(Thread.java:748)
	Suppressed: java.lang.IllegalStateException: No context information for thread: Thread[id=29, name=Thread-6, state=RUNNABLE, group=TGRP-ElasticSearchServiceITest]. Is this thread running under a class com.carrotsearch.randomizedtesting.RandomizedRunner runner context? Add @RunWith(class com.carrotsearch.randomizedtesting.RandomizedRunner.class) to your test class. Make sure your code accesses random contexts within @BeforeClass and @AfterClass boundary (for example, static test class initializers are not permitted to access random contexts).
		at com.carrotsearch.randomizedtesting.RandomizedContext.context(RandomizedContext.java:248)
		at com.carrotsearch.randomizedtesting.RandomizedContext.current(RandomizedContext.java:134)
		at com.carrotsearch.randomizedtesting.RandomizedRunner.augmentStackTrace(RandomizedRunner.java:1848)
		at com.carrotsearch.randomizedtesting.RunnerThreadGroup.uncaughtException(RunnerThreadGroup.java:20)
		at java.lang.Thread.dispatchUncaughtException(Thread.java:1959)

```

What I'm doing wrong? I haven't added any functionality but get the error.

---

<div class="post-metadata">

**Author:** ![ahmadimt07](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ahmadimt07/32/10031_2.png) [@ahmadimt07](https://discuss.elastic.co/u/ahmadimt07)\
**Post date:** [March 13, 2018, 3:00pm UTC](https://discuss.elastic.co/t/elasticsearch-java-integration-tests/123750/2 "2018-03-13T15:00:49Z")

</div>

Hi,

May be this can help you:

> <https://github.com/elastic/elasticsearch/issues/14348>

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 10, 2018, 3:00pm UTC](https://discuss.elastic.co/t/elasticsearch-java-integration-tests/123750/3 "2018-04-10T15:00:53Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
