Skip to content

Commit

Permalink
unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
l-trotta committed Jul 30, 2024
1 parent 26849dc commit 23ac082
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
}
}

0 comments on commit 23ac082

Please sign in to comment.