aboutsummaryrefslogtreecommitdiff
path: root/javatests/com/google/turbine/processing/TurbineMessagerTest.java
diff options
context:
space:
mode:
authorLiam Miller-Cushon <cushon@google.com>2021-07-18 14:42:47 -0700
committerJavac Team <javac-team+copybara@google.com>2021-07-18 14:43:16 -0700
commit5b53d38e73c8412a9591cd9ced29b8f1978025fb (patch)
tree46596ce941bad91ea68a42f04d611f39da52752b /javatests/com/google/turbine/processing/TurbineMessagerTest.java
parenta47da7ba2b1f651d79ebfb095d9e810ead736a23 (diff)
downloadturbine-5b53d38e73c8412a9591cd9ced29b8f1978025fb.tar.gz
Annotate binder and related packages for nullness
PiperOrigin-RevId: 385446789
Diffstat (limited to 'javatests/com/google/turbine/processing/TurbineMessagerTest.java')
-rw-r--r--javatests/com/google/turbine/processing/TurbineMessagerTest.java47
1 files changed, 23 insertions, 24 deletions
diff --git a/javatests/com/google/turbine/processing/TurbineMessagerTest.java b/javatests/com/google/turbine/processing/TurbineMessagerTest.java
index 017012c..b8e9cfa 100644
--- a/javatests/com/google/turbine/processing/TurbineMessagerTest.java
+++ b/javatests/com/google/turbine/processing/TurbineMessagerTest.java
@@ -20,6 +20,7 @@ import static com.google.common.collect.ImmutableList.toImmutableList;
import static com.google.common.truth.Truth.assertThat;
import static java.util.Comparator.comparing;
import static java.util.Objects.requireNonNull;
+import static org.junit.Assert.assertThrows;
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
@@ -199,35 +200,33 @@ public class TurbineMessagerTest {
.map(TurbineMessagerTest::formatDiagnostic)
.collect(toImmutableList());
- ImmutableList<String> turbineDiagnostics;
ImmutableList<Tree.CompUnit> units =
SOURCES.sources.entrySet().stream()
.map(e -> new SourceFile(e.getKey(), e.getValue()))
.map(Parser::parse)
.collect(toImmutableList());
- try {
- Binder.bind(
- units,
- ClassPathBinder.bindClasspath(ImmutableList.of()),
- Processing.ProcessorInfo.create(
- ImmutableList.of(new DiagnosticTesterProcessor()),
- getClass().getClassLoader(),
- ImmutableMap.of(),
- SourceVersion.latestSupported()),
- TestClassPaths.TURBINE_BOOTCLASSPATH,
- Optional.empty());
- throw new AssertionError();
- } catch (TurbineError e) {
- turbineDiagnostics =
- e.diagnostics().stream()
- .sorted(
- comparing(TurbineDiagnostic::path)
- .thenComparing(TurbineDiagnostic::line)
- .thenComparing(TurbineDiagnostic::column))
- .map(TurbineMessagerTest::formatDiagnostic)
- .collect(toImmutableList());
- }
-
+ TurbineError e =
+ assertThrows(
+ TurbineError.class,
+ () ->
+ Binder.bind(
+ units,
+ ClassPathBinder.bindClasspath(ImmutableList.of()),
+ Processing.ProcessorInfo.create(
+ ImmutableList.of(new DiagnosticTesterProcessor()),
+ getClass().getClassLoader(),
+ ImmutableMap.of(),
+ SourceVersion.latestSupported()),
+ TestClassPaths.TURBINE_BOOTCLASSPATH,
+ Optional.empty()));
+ ImmutableList<String> turbineDiagnostics =
+ e.diagnostics().stream()
+ .sorted(
+ comparing(TurbineDiagnostic::path)
+ .thenComparing(TurbineDiagnostic::line)
+ .thenComparing(TurbineDiagnostic::column))
+ .map(TurbineMessagerTest::formatDiagnostic)
+ .collect(toImmutableList());
assertThat(turbineDiagnostics).containsExactlyElementsIn(javacDiagnostics).inOrder();
}