Skip to content

Commit

Permalink
Update DiagnosticTestHelper and CompilationTestHelper to take `ja…
Browse files Browse the repository at this point in the history
…va.util.function.Predicate`s

google/guava#6483 (comment)

Startblock:
  * unknown commit is submitted
PiperOrigin-RevId: 531307672
  • Loading branch information
cushon authored and Error Prone Team committed May 13, 2023
1 parent c2b71f9 commit 573c7dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import static org.junit.Assert.fail;

import com.google.common.base.Joiner;
import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableList;
import com.google.common.io.ByteStreams;
import com.google.errorprone.DiagnosticTestHelper.LookForCheckNameInDiagnostic;
Expand All @@ -52,6 +51,7 @@
import java.util.List;
import java.util.Locale;
import java.util.Optional;
import java.util.function.Predicate;
import java.util.jar.JarEntry;
import java.util.jar.JarOutputStream;
import javax.annotation.Nullable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import static org.hamcrest.Matchers.hasItem;
import static org.junit.Assert.fail;

import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Sets;
import com.google.common.io.CharSource;
Expand All @@ -38,6 +37,7 @@
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import javax.tools.Diagnostic;
import javax.tools.DiagnosticListener;
Expand Down Expand Up @@ -195,7 +195,7 @@ public boolean matchesSafely(
return false;
}

if (!matcher.apply(item.getMessage(Locale.getDefault()))) {
if (!matcher.test(item.getMessage(Locale.getDefault()))) {
mismatchDescription.appendText("diagnostic does not match ").appendValue(matcher);
return false;
}
Expand Down Expand Up @@ -400,7 +400,7 @@ private static class SimpleStringContains implements Predicate<String> {
}

@Override
public boolean apply(String input) {
public boolean test(String input) {
return input.contains(pattern);
}

Expand Down

0 comments on commit 573c7dc

Please sign in to comment.