Add current vs expected
This commit is contained in:
parent
df3104b032
commit
bc3a37b65f
2 changed files with 12 additions and 5 deletions
|
@ -62,7 +62,7 @@ public class SearchResult {
|
|||
double res = 1;
|
||||
if (match) {
|
||||
res = ObjectType.getTypeWeight(match ? objectType : null);
|
||||
fullCompleteMatch = getSelfPhrase().equals(name);
|
||||
fullCompleteMatch = getSelfPhrase().equalsIgnoreCase(name);
|
||||
if (fullCompleteMatch) {
|
||||
res = res * 10;
|
||||
}
|
||||
|
|
|
@ -180,20 +180,27 @@ public class SearchUICoreTest {
|
|||
SearchResultCollection collection = new SearchResultCollection(phrase);
|
||||
collection.addSearchResults(matcher.getRequestResults(), true, true);
|
||||
List<SearchResult> searchResults = collection.getCurrentSearchResults();
|
||||
for(int i = 0; i < result.size(); i++) {
|
||||
for (int i = 0; i < result.size(); i++) {
|
||||
String expected = result.get(i);
|
||||
SearchResult res = i >= searchResults.size() ? null : searchResults.get(i);
|
||||
if (simpleTest && expected.indexOf('[') != -1) {
|
||||
expected = expected.substring(0, expected.indexOf('[')).trim();
|
||||
}
|
||||
// String present = result.toString();
|
||||
String present = res == null ? ("#MISSING " + (i+1)) : formatResult(simpleTest, res, phrase);
|
||||
// String present = result.toString();
|
||||
String present = res == null ? ("#MISSING " + (i + 1)) : formatResult(simpleTest, res, phrase);
|
||||
if (!Algorithms.stringsEqual(expected, present)) {
|
||||
System.out.println(String.format("Phrase: %s", phrase));
|
||||
System.out.println(String.format("Mismatch for '%s' != '%s'. Result: ", expected, present));
|
||||
}
|
||||
System.out.println("CURRENT RESULTS: ");
|
||||
for (SearchResult r : searchResults) {
|
||||
System.out.println(String.format("\t\"%s\",", formatResult(false, r, phrase)));
|
||||
|
||||
}
|
||||
System.out.println("EXPECTED : ");
|
||||
for (String r : result) {
|
||||
System.out.println(String.format("\t\"%s\",", r));
|
||||
|
||||
}
|
||||
}
|
||||
Assert.assertEquals(expected, present);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue