Skip to content

Commit

Permalink
SOLR-15440: move assertions out of helper functions
Browse files Browse the repository at this point in the history
  • Loading branch information
tomglk committed Sep 9, 2023
1 parent e765601 commit ffea1a8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,9 @@ public void testThatCorrectFieldValueFeatureIsUsedForDocValueTypes() throws Exce

loadFeatureAndModel(getObservingFieldValueFeatureClassName(), field, fstore, modelName);

addAndQueryId21(field, modelName, fieldAndScorerClass[2], fieldValue);
addAndQueryId21(field, modelName, fieldValue);

assertEquals(fieldAndScorerClass[2], ObservingFieldValueFeature.usedScorerClass);
}
}

Expand All @@ -547,7 +549,7 @@ protected void loadFeatureAndModel(
}

protected void addAndQueryId21(
String field, String modelName, String expectedUsedScorerClass, String fieldValue)
String field, String modelName, String fieldValue)
throws Exception {

assertU(adoc("id", "21", field, fieldValue));
Expand All @@ -564,8 +566,6 @@ protected void addAndQueryId21(
"/response/docs/[0]/=={'[fv]':'"
+ FeatureLoggerTestUtils.toFeatureVector(field, "1.0")
+ "'}");

assertEquals(expectedUsedScorerClass, ObservingFieldValueFeature.usedScorerClass);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,23 @@ public void test_LegacyFieldValueFeature_behavesDifferentlyThan_FieldValueFeatur
// the LegacyFieldValueFeature does not use docValues
loadAndQuery(
getObservingFieldValueFeatureClassName(),
field,
FieldValueFeature.FieldValueFeatureWeight.FieldValueFeatureScorer.class.getName());
field);

assertEquals(
FieldValueFeature.FieldValueFeatureWeight.FieldValueFeatureScorer.class.getName(),
ObservingFieldValueFeature.usedScorerClass);

// the FieldValueFeature does use docValues
loadAndQuery(
super.getObservingFieldValueFeatureClassName(),
field,
FieldValueFeature.FieldValueFeatureWeight.SortedDocValuesFieldValueFeatureScorer.class
.getName());
field);

assertEquals(
FieldValueFeature.FieldValueFeatureWeight.SortedDocValuesFieldValueFeatureScorer.class.getName(),
ObservingFieldValueFeature.usedScorerClass);
}

private void loadAndQuery(String featureClassName, String field, String expectedUsedScorerClass)
private void loadAndQuery(String featureClassName, String field)
throws Exception {
final String modelName = field + "-model-" + featureClassName;
final String featureStoreName =
Expand All @@ -80,6 +85,6 @@ private void loadAndQuery(String featureClassName, String field, String expected

loadFeatureAndModel(featureClassName, field, featureStoreName, modelName);

addAndQueryId21(field, modelName, expectedUsedScorerClass, "1");
addAndQueryId21(field, modelName, "1");
}
}

0 comments on commit ffea1a8

Please sign in to comment.