Migrate Correspondence subclasses to instead call Correspondence.from.
This makes the code shorter, and the subclassing approach is deprecated.
@@ -269,19 +269,13 @@ public class TranspilerTester {
Pattern.compile("(?:(?:Error)|(?:Warning))(?::[\\w.]+:\\d+)?: (?<message>.*)");
private static final Correspondence<String, String> ERROR_WITHOUT_SOURCE_POSITION_COMPARATOR =
- new Correspondence<String, String>() {
- @Override
- public boolean compare(String actual, String expected) {
+ Correspondence.from(TranspileResult::compare, "contained within");
+
+ private static boolean compare(String actual, String expected) {
Matcher matcher = messagePattern.matcher(actual);
checkState(matcher.matches());
return matcher.group("message").equals(expected);
}
-
- @Override
- public String toString() {
- return "contained within";
- }
- };
}
private static TranspileResult invokeTranspiler(Iterable<String> args, Path outputPath) {
