[Tests] Fixing test failure in CompletionSuggesterBuilderTests
@@ -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) {
