From c91ec7c730bd728c449cbcbba839febc564551a2 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Mon, 14 Jul 2014 17:17:24 +0200 Subject: [PATCH] [TEST] fix compile problems on Java 8 --- .../org/elasticsearch/script/IndexedScriptTests.java | 6 +++--- .../org/elasticsearch/script/OnDiskScriptTests.java | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/test/java/org/elasticsearch/script/IndexedScriptTests.java b/src/test/java/org/elasticsearch/script/IndexedScriptTests.java index c6484b863ed..4d0560e320a 100644 --- a/src/test/java/org/elasticsearch/script/IndexedScriptTests.java +++ b/src/test/java/org/elasticsearch/script/IndexedScriptTests.java @@ -24,7 +24,6 @@ import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.search.SearchHit; import org.elasticsearch.test.ElasticsearchIntegrationTest; -import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; import org.junit.Test; import java.util.ArrayList; @@ -32,6 +31,7 @@ import java.util.List; import java.util.concurrent.ExecutionException; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount; +import static org.hamcrest.Matchers.equalTo; public class IndexedScriptTests extends ElasticsearchIntegrationTest { @@ -63,7 +63,7 @@ public class IndexedScriptTests extends ElasticsearchIntegrationTest { assertHitCount(searchResponse,5); assertTrue(searchResponse.getHits().hits().length == 1); SearchHit sh = searchResponse.getHits().getAt(0); - assertTrue(sh.field("test1").getValue() == 2); - assertTrue(sh.field("test2").getValue() == 6); + assertThat((Integer)sh.field("test1").getValue(), equalTo(2)); + assertThat((Integer)sh.field("test2").getValue(), equalTo(6)); } } diff --git a/src/test/java/org/elasticsearch/script/OnDiskScriptTests.java b/src/test/java/org/elasticsearch/script/OnDiskScriptTests.java index 40a137e50e6..936136b42bb 100644 --- a/src/test/java/org/elasticsearch/script/OnDiskScriptTests.java +++ b/src/test/java/org/elasticsearch/script/OnDiskScriptTests.java @@ -31,6 +31,7 @@ import java.util.concurrent.ExecutionException; import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount; +import static org.hamcrest.Matchers.equalTo; //Use Suite scope so that paths get set correctly @ElasticsearchIntegrationTest.ClusterScope(scope = ElasticsearchIntegrationTest.Scope.SUITE) @@ -60,8 +61,8 @@ public class OnDiskScriptTests extends ElasticsearchIntegrationTest { assertHitCount(searchResponse,5); assertTrue(searchResponse.getHits().hits().length == 1); SearchHit sh = searchResponse.getHits().getAt(0); - assertTrue(sh.field("test1").getValue() == 2); - assertTrue(sh.field("test2").getValue() == 6); + assertThat((Integer)sh.field("test1").getValue(), equalTo(2)); + assertThat((Integer)sh.field("test2").getValue(), equalTo(6)); } @@ -83,9 +84,8 @@ public class OnDiskScriptTests extends ElasticsearchIntegrationTest { assertHitCount(searchResponse,5); assertTrue(searchResponse.getHits().hits().length == 1); SearchHit sh = searchResponse.getHits().getAt(0); - assertTrue(sh.field("test1").getValue() == 2); - assertTrue(sh.field("test2").getValue() == 6); - + assertThat((Integer)sh.field("test1").getValue(), equalTo(2)); + assertThat((Integer)sh.field("test2").getValue(), equalTo(6)); }