Skip to content

Commit 5668ec6

Browse files
committed
Loosen testBug164791 as result tested is too specific
Signed-off-by: Rob Stryker <[email protected]>
1 parent 6302842 commit 5668ec6

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaSearchTests.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.util.Comparator;
2222
import java.util.List;
2323
import java.util.stream.Collectors;
24+
import junit.framework.AssertionFailedError;
2425
import org.eclipse.core.resources.IFile;
2526
import org.eclipse.core.resources.IProject;
2627
import org.eclipse.core.resources.IResource;
@@ -910,6 +911,21 @@ protected void assertSearchResults(String expected) {
910911
protected void assertSearchResults(String expected, JavaSearchResultCollector collector) {
911912
assertSearchResults("Unexpected search results", expected, collector);
912913
}
914+
915+
protected void assertSearchResultsWithAlternate(String expected1, String expected2, JavaSearchResultCollector collector) {
916+
AssertionFailedError afe = null;
917+
try {
918+
assertSearchResults(expected1,collector);
919+
} catch(AssertionFailedError afe2) {
920+
afe = afe2;
921+
try {
922+
assertSearchResults(expected2,collector);
923+
} catch(AssertionFailedError afe3) {
924+
throw afe;
925+
}
926+
}
927+
}
928+
913929
protected void assertSearchResults(String message, String expected, JavaSearchResultCollector collector) {
914930
String actual = Arrays.stream(collector.toString().split("\n"))
915931
.sorted()

org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8606,11 +8606,11 @@ public void acceptSearchMatch(SearchMatch searchMatch) throws CoreException {
86068606
};
86078607
collector.showAccuracy(true);
86088608
search(type, REFERENCES, getJavaSearchScope(), collector);
8609-
assertSearchResults(
8610-
"lib/b164791.jar test.<anonymous> EXACT_MATCH\n" +
8611-
"lib/b164791.jar test.<anonymous> EXACT_MATCH",
8612-
collector
8613-
);
8609+
String expected1 = "lib/b164791.jar test.<anonymous> EXACT_MATCH\n" +
8610+
"lib/b164791.jar test.<anonymous> EXACT_MATCH";
8611+
String expected2 = "lib/b164791.jar test.<anonymous> EXACT_MATCH\n" +
8612+
"lib/b164791.jar test.Test EXACT_MATCH";
8613+
assertSearchResultsWithAlternate(expected1, expected2, collector);
86148614
}
86158615

86168616
/**

0 commit comments

Comments
 (0)