From 66da097630dccc29da677f4a32ed8b468bceff3d Mon Sep 17 00:00:00 2001 From: Sylvain Wallez Date: Fri, 29 Apr 2022 14:42:29 +0200 Subject: [PATCH] Fix tests --- .../documentation/api_conventions/LoadingJsonTest.java | 2 +- .../clients/documentation/usage/AggregationsTest.java | 2 +- .../clients/documentation/usage/SearchingTest.java | 2 +- .../elastic/clients/json/JsonpMappingExceptionTest.java | 2 +- .../test/java/co/elastic/clients/json/WithJsonTest.java | 8 +++++--- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/java-client/src/test/java/co/elastic/clients/documentation/api_conventions/LoadingJsonTest.java b/java-client/src/test/java/co/elastic/clients/documentation/api_conventions/LoadingJsonTest.java index 20eff94dd..867d922c4 100644 --- a/java-client/src/test/java/co/elastic/clients/documentation/api_conventions/LoadingJsonTest.java +++ b/java-client/src/test/java/co/elastic/clients/documentation/api_conventions/LoadingJsonTest.java @@ -49,7 +49,7 @@ public class LoadingJsonTest extends ModelTestCase { private final DocTestsTransport transport = new DocTestsTransport(); private final ElasticsearchClient client = new ElasticsearchClient(transport); - private static final SearchResponse searchResponse = SearchResponse.searchResponseOf(b -> b + private static final SearchResponse searchResponse = SearchResponse.of(b -> b .aggregations(new HashMap<>()) .took(0) .timedOut(false) diff --git a/java-client/src/test/java/co/elastic/clients/documentation/usage/AggregationsTest.java b/java-client/src/test/java/co/elastic/clients/documentation/usage/AggregationsTest.java index cef1d6466..2e5606d47 100644 --- a/java-client/src/test/java/co/elastic/clients/documentation/usage/AggregationsTest.java +++ b/java-client/src/test/java/co/elastic/clients/documentation/usage/AggregationsTest.java @@ -44,7 +44,7 @@ public class AggregationsTest extends ModelTestCase { private final Logger logger = LoggerFactory.getLogger(this.getClass()); - private static final SearchResponse searchResponse = SearchResponse.searchResponseOf(b -> b + private static final SearchResponse searchResponse = SearchResponse.of(b -> b .aggregations(new HashMap<>()) .took(0) .timedOut(false) diff --git a/java-client/src/test/java/co/elastic/clients/documentation/usage/SearchingTest.java b/java-client/src/test/java/co/elastic/clients/documentation/usage/SearchingTest.java index f95077736..fe9c3fd94 100644 --- a/java-client/src/test/java/co/elastic/clients/documentation/usage/SearchingTest.java +++ b/java-client/src/test/java/co/elastic/clients/documentation/usage/SearchingTest.java @@ -44,7 +44,7 @@ public class SearchingTest { private final Logger logger = LoggerFactory.getLogger(this.getClass()); - private static final SearchResponse searchResponse = SearchResponse.searchResponseOf(b -> b + private static final SearchResponse searchResponse = SearchResponse.of(b -> b .aggregations(new HashMap<>()) .took(0) .timedOut(false) diff --git a/java-client/src/test/java/co/elastic/clients/json/JsonpMappingExceptionTest.java b/java-client/src/test/java/co/elastic/clients/json/JsonpMappingExceptionTest.java index 2b9837abd..4c753459d 100644 --- a/java-client/src/test/java/co/elastic/clients/json/JsonpMappingExceptionTest.java +++ b/java-client/src/test/java/co/elastic/clients/json/JsonpMappingExceptionTest.java @@ -69,7 +69,7 @@ public void testObjectAndArrayPath() { JsonpMappingException e = assertThrows(JsonpMappingException.class, () -> { // withJson() will read values of the generic parameter type as JsonData - SearchResponse r = SearchResponse.searchResponseOf(b -> b + SearchResponse r = SearchResponse.of(b -> b .withJson(new StringReader(json)) ); }); diff --git a/java-client/src/test/java/co/elastic/clients/json/WithJsonTest.java b/java-client/src/test/java/co/elastic/clients/json/WithJsonTest.java index 5d1770b4b..8a5699489 100644 --- a/java-client/src/test/java/co/elastic/clients/json/WithJsonTest.java +++ b/java-client/src/test/java/co/elastic/clients/json/WithJsonTest.java @@ -52,14 +52,16 @@ public void testRequestWithGenericValueBody() { @Test public void testRequestWithValueBody() { String json = "{" + - "\"analyze.max_token_count\": 12" + + "\"analyze\": {" + + " \"max_token_count\": 12" + + " }" + "}"; PutIndicesSettingsRequest req = PutIndicesSettingsRequest.of(b -> b .withJson(new StringReader(json)) ); - assertEquals(12, req.settings().analyzeMaxTokenCount().intValue()); + assertEquals(12, req.settings().analyze().maxTokenCount().intValue()); } @Test @@ -108,7 +110,7 @@ public void testObjectWithGenericParam() { "}"; // withJson() will read values of the generic parameter type as JsonData - SearchResponse r = SearchResponse.searchResponseOf(b -> b + SearchResponse r = SearchResponse.of(b -> b .withJson(new StringReader(json)) );