This commit is contained in:
Simon Willnauer 2016-02-12 15:34:50 +01:00
parent 8d568ce3e1
commit 84d91c87a1
1 changed files with 3 additions and 1 deletions

View File

@ -41,6 +41,7 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
@ -282,7 +283,8 @@ public class TermsQueryBuilderTests extends AbstractQueryTestCase<TermsQueryBuil
} catch (UnsupportedOperationException ex) { } catch (UnsupportedOperationException ex) {
assertEquals("query must be rewritten first", ex.getMessage()); assertEquals("query must be rewritten first", ex.getMessage());
} }
assertEquals(termsQueryBuilder.rewrite(queryShardContext()), new TermsQueryBuilder(STRING_FIELD_NAME, randomTerms)); assertEquals(termsQueryBuilder.rewrite(queryShardContext()), new TermsQueryBuilder(STRING_FIELD_NAME,
randomTerms.stream().filter(x -> x != null).collect(Collectors.toList()))); // terms lookup removes null values
} }
} }