[Tests] Fixing test failure in CompletionSuggesterBuilderTests

This commit is contained in:
Christoph Büscher 2017-07-07 10:39:58 +02:00
parent 00a9811f02
commit 31f73cc06c
No known key found for this signature in database
GPG Key ID: CEABB29FCAEF147D
1 changed files with 26 additions and 26 deletions

View File

@ -152,6 +152,8 @@ public abstract class AbstractSuggestionBuilderTestCase<SB extends SuggestionBui
}
public void testBuild() throws IOException {
for (int runs = 0; runs < NUMBER_OF_TESTBUILDERS; runs++) {
SB suggestionBuilder = randomTestBuilder();
Settings indexSettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build();
IndexSettings idxSettings = IndexSettingsModule.newIndexSettings(new Index(randomAlphaOfLengthBetween(1, 10), "_na_"),
indexSettings);
@ -177,8 +179,6 @@ public abstract class AbstractSuggestionBuilderTestCase<SB extends SuggestionBui
QueryShardContext mockShardContext = new QueryShardContext(0, idxSettings, null, null, mapperService, null, scriptService,
xContentRegistry(), null, null, System::currentTimeMillis);
for (int runs = 0; runs < NUMBER_OF_TESTBUILDERS; runs++) {
SB suggestionBuilder = randomTestBuilder();
SuggestionContext suggestionContext = suggestionBuilder.build(mockShardContext);
assertEquals(toBytesRef(suggestionBuilder.text()), suggestionContext.getText());
if (suggestionBuilder.text() != null && suggestionBuilder.prefix() == null) {