Skip to content

Commit

Permalink
Assert not null for databases field (#95497) (#95499)
Browse files Browse the repository at this point in the history
  • Loading branch information
gmarouli authored Apr 24, 2023
1 parent 0df40fd commit 70b5f20
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.notNullValue;

public class IngestGeoIpClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {

Expand Down Expand Up @@ -79,10 +80,10 @@ public void waitForDatabases() throws Exception {
Map<?, ?> nodes = (Map<?, ?>) response.get("nodes");
assertThat(nodes.size(), equalTo(1));
Map<?, ?> node = (Map<?, ?>) nodes.values().iterator().next();
List<String> databases = ((List<?>) node.get("databases")).stream()
.map(o -> (String) ((Map<?, ?>) o).get("name"))
.collect(Collectors.toList());
assertThat(databases, containsInAnyOrder("GeoLite2-City.mmdb", "GeoLite2-Country.mmdb", "GeoLite2-ASN.mmdb"));
List<?> databases = ((List<?>) node.get("databases"));
assertThat(databases, notNullValue());
List<String> databaseNames = databases.stream().map(o -> (String) ((Map<?, ?>) o).get("name")).collect(Collectors.toList());
assertThat(databaseNames, containsInAnyOrder("GeoLite2-City.mmdb", "GeoLite2-Country.mmdb", "GeoLite2-ASN.mmdb"));
});
}

Expand Down

0 comments on commit 70b5f20

Please sign in to comment.