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/FunctionTest.java b/src/test/java/com/google/devtools/build/lib/syntax/FunctionTest.java
index 37f3b95..d5d3937 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/FunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/FunctionTest.java
@@ -52,7 +52,7 @@
     setFailFast(false);
     parseFile("def func(a,b,a):",
         "  a = 1\n");
-    assertContainsEvent("duplicate parameter name in function definition");
+    assertContainsError("duplicate parameter name in function definition");
   }
 
   @Test