From 23ac082fd65d1df5391390f42f652f205551c62d Mon Sep 17 00:00:00 2001 From: Laura Trotta Date: Tue, 30 Jul 2024 12:07:18 +0200 Subject: [PATCH] unit test --- .../clients/elasticsearch/model/BehaviorsTest.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/BehaviorsTest.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/BehaviorsTest.java index 926f19391..6091c9421 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/BehaviorsTest.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/BehaviorsTest.java @@ -29,6 +29,7 @@ import co.elastic.clients.elasticsearch._types.query_dsl.Query; import co.elastic.clients.elasticsearch._types.query_dsl.ShapeQuery; import co.elastic.clients.elasticsearch._types.query_dsl.TermQuery; +import co.elastic.clients.elasticsearch.connector.UpdateIndexNameRequest; import co.elastic.clients.json.JsonData; import co.elastic.clients.testkit.ModelTestCase; import co.elastic.clients.util.MapBuilder; @@ -169,4 +170,16 @@ public void testShortcutProperty() { assertEquals("some-field", q.term().field()); assertEquals("some-value", q.term().value().stringValue()); } + + @Test + public void testWithNull() { + + String jsonValue = "{\"index_name\":\"value\"}"; + String jsonNull = "{\"index_name\":null}"; + UpdateIndexNameRequest updateValue = UpdateIndexNameRequest.of(u -> u.connectorId("connector").indexName("value")); + UpdateIndexNameRequest updateNull = UpdateIndexNameRequest.of(u -> u.connectorId("connector").indexNameWithNull()); + + assertEquals(jsonValue,toJson(updateValue)); + assertEquals(jsonNull,toJson(updateNull)); + } }