# Elastic Junit and integration test classes does not run after 2.3.5 upgrade

**URL:** <https://discuss.elastic.co/t/elastic-junit-and-integration-test-classes-does-not-run-after-2-3-5-upgrade/58350>\
**Category:** Elasticsearch\
**Created:** [August 18, 2016, 1:56pm UTC](https://discuss.elastic.co/t/elastic-junit-and-integration-test-classes-does-not-run-after-2-3-5-upgrade/58350 "2016-08-18T13:56:05Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![iliasse](https://avatars.discourse-cdn.com/v4/letter/i/22d042/32.png) [@iliasse](https://discuss.elastic.co/u/iliasse)\
**Post date:** [August 18, 2016, 1:56pm UTC](https://discuss.elastic.co/t/elastic-junit-and-integration-test-classes-does-not-run-after-2-3-5-upgrade/58350/1 "2016-08-18T13:56:05Z")

</div>

Hi,

I upgraded to ES 2.3.5 and changed my pom.xml accordingly, but i'm getting an exception (see below) which happens for all Elastic related class tests.

Exception :

```
août 18, 2016 3:48:23 PM com.carrotsearch.randomizedtesting.RandomizedRunner$QueueUncaughtExceptionsHandler uncaughtException
AVERTISSEMENT: Uncaught exception in thread: Thread[SUITE-ElasticUpdateTest-seed#[690F6B4815D7B165],5,TGRP-ElasticUpdateTest]
java.lang.NoClassDefFoundError: Could not initialize class org.elasticsearch.common.Strings
	at __randomizedtesting.SeedInfo.seed([690F6B4815D7B165]:0)
	at org.elasticsearch.test.junit.listeners.ReproduceInfoPrinter$MavenMessageBuilder.appendOpt(ReproduceInfoPrinter.java:175)
	at com.carrotsearch.randomizedtesting.ReproduceErrorMessageBuilder.appendAllOpts(ReproduceErrorMessageBuilder.java:42)
	at org.elasticsearch.test.junit.listeners.ReproduceInfoPrinter$MavenMessageBuilder.appendAllOpts(ReproduceInfoPrinter.java:122)
	at org.elasticsearch.test.junit.listeners.ReproduceInfoPrinter.testFailure(ReproduceInfoPrinter.java:89)
	at org.junit.runner.notification.SynchronizedRunListener.testFailure(SynchronizedRunListener.java:63)
	at org.junit.runner.notification.RunNotifier$4.notifyListener(RunNotifier.java:142)
	at org.junit.runner.notification.RunNotifier$SafeNotifier.run(RunNotifier.java:72)
	at org.junit.runner.notification.RunNotifier.fireTestFailures(RunNotifier.java:138)
	at org.junit.runner.notification.RunNotifier.fireTestFailure(RunNotifier.java:132)
	at com.carrotsearch.randomizedtesting.RandomizedRunner$2.run(RandomizedRunner.java:594)

```

Here is my pom.xml :

```
<properties>
                 <es.version>2.3.5</es.version>
		<randomizedtesting-runner.version>2.3.2</randomizedtesting-runner.version>
		<lucene.version>5.5.0</lucene.version>
		<hamcrest.version>1.3</hamcrest.version>
		<junit.version>4.11</junit.version>
</properties> 

<dependencies>
<dependency>
			<groupId>com.carrotsearch.randomizedtesting</groupId>
			<artifactId>randomizedtesting-runner</artifactId>
			<version>${randomizedtesting-runner.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<scope>test</scope>
			<version>${junit.version}</version>
		</dependency>
		<dependency>
			<groupId>org.apache.lucene</groupId>
			<artifactId>lucene-core</artifactId>
			<version>${lucene.version}</version>
		</dependency>
		<dependency>
			<groupId>org.apache.lucene</groupId>
			<artifactId>lucene-test-framework</artifactId>
			<version>${lucene.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.elasticsearch</groupId>
			<artifactId>elasticsearch</artifactId>
			<type>test-jar</type>
			<version>${es.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.hamcrest</groupId>
			<artifactId>hamcrest-core</artifactId>
			<version>${hamcrest.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.hamcrest</groupId>
			<artifactId>hamcrest-library</artifactId>
			<version>${hamcrest.version}</version>
			<scope>test</scope>
		</dependency>
</dependencies>

```

Do you have any idea why I am getting this exception ? I tried cleaning the mvn repository but it did not work.  
Thank you for your help.

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [August 19, 2016, 9:06am UTC](https://discuss.elastic.co/t/elastic-junit-and-integration-test-classes-does-not-run-after-2-3-5-upgrade/58350/2 "2016-08-19T09:06:41Z")

</div>

The message complains about `org.elasticsearch.common.Strings`, can you check whether it is actually included in the jars? (using `jar -tvf` for instance)

---

<div class="post-metadata">

**Author:** ![iliasse](https://avatars.discourse-cdn.com/v4/letter/i/22d042/32.png) [@iliasse](https://discuss.elastic.co/u/iliasse)\
**Post date:** [August 19, 2016, 9:29am UTC](https://discuss.elastic.co/t/elastic-junit-and-integration-test-classes-does-not-run-after-2-3-5-upgrade/58350/3 "2016-08-19T09:29:59Z")

</div>

Thank you for your answer.  
Yes the jar contains the `org.elasticsearch.common.Strings` class at the corresponding path.  
I tried modifying the versions of the different dependencies on my pom.xml and still no result.

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [August 19, 2016, 9:48am UTC](https://discuss.elastic.co/t/elastic-junit-and-integration-test-classes-does-not-run-after-2-3-5-upgrade/58350/4 "2016-08-19T09:48:24Z")

</div>

Would you be able to reproduce this issue in a minimal Maven project so that I can look into it?

---

<div class="post-metadata">

**Author:** ![iliasse](https://avatars.discourse-cdn.com/v4/letter/i/22d042/32.png) [@iliasse](https://discuss.elastic.co/u/iliasse)\
**Post date:** [August 19, 2016, 1:20pm UTC](https://discuss.elastic.co/t/elastic-junit-and-integration-test-classes-does-not-run-after-2-3-5-upgrade/58350/5 "2016-08-19T13:20:09Z")

</div>

What do you mean by minimal ? I think that My project is a minimal one 😕  
I'am not using any exotic dependency or jar.  
Thank you for your time.

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [August 19, 2016, 3:44pm UTC](https://discuss.elastic.co/t/elastic-junit-and-integration-test-classes-does-not-run-after-2-3-5-upgrade/58350/6 "2016-08-19T15:44:01Z")

</div>

Yes that's perfect, but I meant a complete one including a test file in addition to the pom.xml so that I can be sure to replicate the same problem as you have.

---

<div class="post-metadata">

**Author:** ![iliasse](https://avatars.discourse-cdn.com/v4/letter/i/22d042/32.png) [@iliasse](https://discuss.elastic.co/u/iliasse)\
**Post date:** [August 22, 2016, 8:22am UTC](https://discuss.elastic.co/t/elastic-junit-and-integration-test-classes-does-not-run-after-2-3-5-upgrade/58350/7 "2016-08-22T08:22:10Z")

</div>

Thank you for answering.

I am Not sure to understand...  
Though, here is a test class I am using and that fails with the exception mentioned above :

```
public class ElasticDeleteTest extends AbstractElasticsearchUnitTest {

   private ElasticDeleter elasticDelete;

   private void initElasticDelete() throws Exception {

      this.elasticDelete = new ElasticDeleter() {
         @Override
         public <ConsumerInputType> void notifyConsumers(ConsumerInputType data) throws Exception {
            // do nothing
         }
      };
      this.elasticDelete.setEsClient(this.getEmbeddedElasticsearchServer());
      // clear all index
      this.getEmbeddedElasticsearchServer().clearAllIndex();
   }

   @Test
   public void testDelete() throws Exception {
      this.initElasticDelete();
      IndexRequestBuilder indexRequest = this.getClient().prepareIndex(ElasticConsts.INDEX_FAMILY, ElasticConsts.FAMILY_TYPE, ElasticTestData.FAN_TEST).setSource(ElasticTestData.FAMILY_JSON_TEST);
      indexRequest.setRefresh(true).execute().actionGet();

      long newCount = this.getEsHelper().count(ElasticConsts.INDEX_FAMILY, ElasticConsts.FAMILY_TYPE);

      SearchResponse response = this.getEsHelper().testSearch(ElasticConsts.INDEX_FAMILY, ElasticConsts.FAMILY_TYPE, ElasticConsts.FAN_FIELD, ElasticTestData.FAN_TEST);
      long hit = response.getHits().getTotalHits();

      DocumentEntry docToDelete = new DocumentEntry(ElasticConsts.FAMILY_TYPE, ElasticTestData.FAN_TEST);

      this.elasticDelete.doTask(docToDelete);

      this.getClient().admin().indices().refresh(new RefreshRequest(ElasticConsts.INDEX_FAMILY)).actionGet();

      response = this.getEsHelper().search(ElasticConsts.INDEX_FAMILY, ElasticConsts.FAMILY_TYPE, ElasticConsts.FAN_FIELD, ElasticTestData.FAN_TEST);
      hit = response.getHits().getTotalHits();

      Assert.assertEquals(0, hit);

   }

}

```

The ElasticDeleter basically calls `client.prepareDelete(index, type, id).setConsistencyLevel(this.consistencyLevel).execute().get();`

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 22, 2016, 9:59am UTC](https://discuss.elastic.co/t/elastic-junit-and-integration-test-classes-does-not-run-after-2-3-5-upgrade/58350/8 "2016-08-22T09:59:11Z")

</div>

He meant that you publish your code on GitHub so he can run:

```
git clone ...
cd ...
mvn test

```

And reproduce your issue.

---

<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:** [July 5, 2017, 10:26pm UTC](https://discuss.elastic.co/t/elastic-junit-and-integration-test-classes-does-not-run-after-2-3-5-upgrade/58350/9 "2017-07-05T22:26:13Z")

</div>


