[TEST] fix compile problems on Java 8

This commit is contained in:
Simon Willnauer 2014-07-14 17:17:24 +02:00
parent 647a2a64a1
commit c91ec7c730
2 changed files with 8 additions and 8 deletions

View File

@ -24,7 +24,6 @@ import org.elasticsearch.action.index.IndexRequestBuilder;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.SearchHit;
import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.elasticsearch.test.ElasticsearchIntegrationTest;
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
import org.junit.Test; import org.junit.Test;
import java.util.ArrayList; import java.util.ArrayList;
@ -32,6 +31,7 @@ import java.util.List;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
import static org.hamcrest.Matchers.equalTo;
public class IndexedScriptTests extends ElasticsearchIntegrationTest { public class IndexedScriptTests extends ElasticsearchIntegrationTest {
@ -63,7 +63,7 @@ public class IndexedScriptTests extends ElasticsearchIntegrationTest {
assertHitCount(searchResponse,5); assertHitCount(searchResponse,5);
assertTrue(searchResponse.getHits().hits().length == 1); assertTrue(searchResponse.getHits().hits().length == 1);
SearchHit sh = searchResponse.getHits().getAt(0); SearchHit sh = searchResponse.getHits().getAt(0);
assertTrue(sh.field("test1").getValue() == 2); assertThat((Integer)sh.field("test1").getValue(), equalTo(2));
assertTrue(sh.field("test2").getValue() == 6); assertThat((Integer)sh.field("test2").getValue(), equalTo(6));
} }
} }

View File

@ -31,6 +31,7 @@ import java.util.concurrent.ExecutionException;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
import static org.hamcrest.Matchers.equalTo;
//Use Suite scope so that paths get set correctly //Use Suite scope so that paths get set correctly
@ElasticsearchIntegrationTest.ClusterScope(scope = ElasticsearchIntegrationTest.Scope.SUITE) @ElasticsearchIntegrationTest.ClusterScope(scope = ElasticsearchIntegrationTest.Scope.SUITE)
@ -60,8 +61,8 @@ public class OnDiskScriptTests extends ElasticsearchIntegrationTest {
assertHitCount(searchResponse,5); assertHitCount(searchResponse,5);
assertTrue(searchResponse.getHits().hits().length == 1); assertTrue(searchResponse.getHits().hits().length == 1);
SearchHit sh = searchResponse.getHits().getAt(0); SearchHit sh = searchResponse.getHits().getAt(0);
assertTrue(sh.field("test1").getValue() == 2); assertThat((Integer)sh.field("test1").getValue(), equalTo(2));
assertTrue(sh.field("test2").getValue() == 6); assertThat((Integer)sh.field("test2").getValue(), equalTo(6));
} }
@ -83,9 +84,8 @@ public class OnDiskScriptTests extends ElasticsearchIntegrationTest {
assertHitCount(searchResponse,5); assertHitCount(searchResponse,5);
assertTrue(searchResponse.getHits().hits().length == 1); assertTrue(searchResponse.getHits().hits().length == 1);
SearchHit sh = searchResponse.getHits().getAt(0); SearchHit sh = searchResponse.getHits().getAt(0);
assertTrue(sh.field("test1").getValue() == 2); assertThat((Integer)sh.field("test1").getValue(), equalTo(2));
assertTrue(sh.field("test2").getValue() == 6); assertThat((Integer)sh.field("test2").getValue(), equalTo(6));
} }