Assert the specific type of event, not just the existence of any event.
Also remove a bunch of custom uses of EventCollector, and use the (already
existing) EventCollectionApparatus instead.
--
MOS_MIGRATED_REVID=106047665
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/ValidationTest.java b/src/test/java/com/google/devtools/build/lib/syntax/ValidationTest.java
index 5f9a712..0f74735 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/ValidationTest.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/ValidationTest.java
@@ -291,7 +291,7 @@
setFailFast(false);
parseFile(
"def GenerateMapNames():", " a = 2", " b = [3, 4]", " if a not b:", " print(a)");
- assertContainsEvent("syntax error at 'b': expected in");
+ assertContainsError("syntax error at 'b': expected in");
// Parser uses "$error" symbol for error recovery.
// It should not be used in error messages.
for (Event event : getEventCollector()) {
@@ -383,6 +383,6 @@
private void checkError(String errorMsg, String... lines) {
setFailFast(false);
parseFile(lines);
- assertContainsEvent(errorMsg);
+ assertContainsError(errorMsg);
}
}