Fixed test, take into account that Map can be the result if max_matches is 1.

This commit is contained in:
Martijn van Groningen 2019-10-15 07:02:11 +02:00
parent 18d7e32b7d
commit c4b1a3045a
No known key found for this signature in database
GPG Key ID: AB236F4FCF2AF12A
1 changed files with 7 additions and 2 deletions

View File

@ -73,8 +73,13 @@ public class MatchProcessorTests extends ESTestCase {
assertThat(termQueryBuilder.fieldName(), equalTo("domain"));
assertThat(termQueryBuilder.value(), equalTo("elastic.co"));
// Check result
Map<?, ?> entry;
if (maxMatches == 1) {
entry = ingestDocument.getFieldValue("entry", Map.class);
} else {
List<?> entries = ingestDocument.getFieldValue("entry", List.class);
Map<?, ?> entry = (Map<?, ?>) entries.get(0);
entry = (Map<?, ?>) entries.get(0);
}
assertThat(entry.size(), equalTo(3));
assertThat(entry.get("globalRank"), equalTo(451));
assertThat(entry.get("tldRank"), equalTo(23));