[TEST] re-enable boost assertions for queries that don't support it

This will be useful to find out whether we forgot to override `setFinalBoost`, otherwise any bost check is simply skipped.
This commit is contained in:
javanna 2015-09-09 09:59:42 +02:00 committed by Luca Cavanna
parent 50c43c9328
commit 6395349bc0
2 changed files with 6 additions and 1 deletions

View File

@ -320,7 +320,7 @@ public abstract class BaseQueryTestCase<QB extends AbstractQueryBuilder<QB>> ext
Query namedQuery = context.copyNamedQueries().get(queryBuilder.queryName()); Query namedQuery = context.copyNamedQueries().get(queryBuilder.queryName());
assertThat(namedQuery, equalTo(query)); assertThat(namedQuery, equalTo(query));
} }
if (query != null && supportsBoostAndQueryName()) { if (query != null) {
assertBoost(queryBuilder, query); assertBoost(queryBuilder, query);
} }
doAssertLuceneQuery(queryBuilder, query, context); doAssertLuceneQuery(queryBuilder, query, context);

View File

@ -62,6 +62,11 @@ public class WrapperQueryBuilderTests extends BaseQueryTestCase<WrapperQueryBuil
} }
} }
@Override
protected void assertBoost(WrapperQueryBuilder queryBuilder, Query query) throws IOException {
//no-op boost is checked already above as part of doAssertLuceneQuery as we rely on lucene equals impl
}
@Test @Test
public void testValidate() { public void testValidate() {
WrapperQueryBuilder wrapperQueryBuilder = new WrapperQueryBuilder((byte[]) null); WrapperQueryBuilder wrapperQueryBuilder = new WrapperQueryBuilder((byte[]) null);