Search in sources :

Example 1 with NodeStatistics

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
}
Also used : NodeStatistics(org.opensearch.client.opensearch._types.NodeStatistics) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 NodeStatistics (org.opensearch.client.opensearch._types.NodeStatistics)1