use of org.opensearch.client.opensearch._types.NodeStatistics in project opensearch-java by opensearch-project.
the class ApiConventionsTest method optionalCollections.
@Test
public void optionalCollections() {
// tag::optional-collections
NodeStatistics stats = NodeStatistics.of(b -> b.total(1).failed(0).successful(1));
// The `failures` list was not provided.
// - it's not null
assertNotNull(stats.failures());
// - it's empty
assertEquals(0, stats.failures().size());
// - and if needed we can know it was actually not defined
assertFalse(ApiTypeHelper.isDefined(stats.failures()));
// end::optional-collections
}
Aggregations