From 3ff139f6605d565831830782135d2ae7a967740b Mon Sep 17 00:00:00 2001 From: cpovirk Date: Wed, 7 Feb 2024 10:23:40 -0800 Subject: [PATCH] Automatic code cleanup. PiperOrigin-RevId: 605025464 --- .../errorprone/ErrorProneFlagsTest.java | 33 +++++++++---------- .../scanner/ScannerSupplierTest.java | 3 +- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/check_api/src/test/java/com/google/errorprone/ErrorProneFlagsTest.java b/check_api/src/test/java/com/google/errorprone/ErrorProneFlagsTest.java index 446d673579d..22ff1776642 100644 --- a/check_api/src/test/java/com/google/errorprone/ErrorProneFlagsTest.java +++ b/check_api/src/test/java/com/google/errorprone/ErrorProneFlagsTest.java @@ -21,7 +21,6 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; -import com.google.common.truth.Truth8; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -38,10 +37,10 @@ public void parseAndGetStringValue() { .parseFlag("-XepOpt:Other:Arg:More:Parts=Long") .parseFlag("-XepOpt:EmptyArg=") .build(); - Truth8.assertThat(flags.get("SomeArg")).hasValue("SomeValue"); - Truth8.assertThat(flags.get("Other:Arg:More:Parts")).hasValue("Long"); - Truth8.assertThat(flags.get("EmptyArg")).hasValue(""); - Truth8.assertThat(flags.get("absent")).isEmpty(); + assertThat(flags.get("SomeArg")).hasValue("SomeValue"); + assertThat(flags.get("Other:Arg:More:Parts")).hasValue("Long"); + assertThat(flags.get("EmptyArg")).hasValue(""); + assertThat(flags.get("absent")).isEmpty(); } @Test @@ -54,17 +53,17 @@ public void parseAndGetBoolean() { .parseFlag("-XepOpt:Arg3=yes") .parseFlag("-XepOpt:Arg4") .build(); - Truth8.assertThat(flags.getBoolean("Arg1")).hasValue(true); - Truth8.assertThat(flags.getBoolean("Arg2")).hasValue(false); + assertThat(flags.getBoolean("Arg1")).hasValue(true); + assertThat(flags.getBoolean("Arg2")).hasValue(false); assertThrows(IllegalArgumentException.class, () -> flags.getBoolean("Arg3")); - Truth8.assertThat(flags.getBoolean("Arg4")).hasValue(true); - Truth8.assertThat(flags.getBoolean("absent")).isEmpty(); + assertThat(flags.getBoolean("Arg4")).hasValue(true); + assertThat(flags.getBoolean("absent")).isEmpty(); } @Test public void parseAndGetImplicitTrue() { ErrorProneFlags flags = ErrorProneFlags.builder().parseFlag("-XepOpt:SomeArg").build(); - Truth8.assertThat(flags.getBoolean("SomeArg")).hasValue(true); + assertThat(flags.getBoolean("SomeArg")).hasValue(true); } @Test @@ -75,10 +74,10 @@ public void parseAndGetInteger() { .parseFlag("-XepOpt:Arg2=20.6") .parseFlag("-XepOpt:Arg3=thirty") .build(); - Truth8.assertThat(flags.getInteger("Arg1")).hasValue(10); + assertThat(flags.getInteger("Arg1")).hasValue(10); assertThrows(NumberFormatException.class, () -> flags.getInteger("Arg2")); assertThrows(NumberFormatException.class, () -> flags.getInteger("Arg3")); - Truth8.assertThat(flags.getInteger("absent")).isEmpty(); + assertThat(flags.getInteger("absent")).isEmpty(); } @Test @@ -145,13 +144,13 @@ public void enumFlags() { .parseFlag("-XepOpt:CaseInsensitiveColours=yellow,green") .parseFlag("-XepOpt:EmptyColours=") .build(); - Truth8.assertThat(flags.getEnum("Colour", Colour.class)).hasValue(Colour.RED); - Truth8.assertThat(flags.getEnumSet("Colours", Colour.class)) + assertThat(flags.getEnum("Colour", Colour.class)).hasValue(Colour.RED); + assertThat(flags.getEnumSet("Colours", Colour.class)) .hasValue(ImmutableSet.of(Colour.YELLOW, Colour.GREEN)); - Truth8.assertThat(flags.getEnumSet("CaseInsensitiveColours", Colour.class)) + assertThat(flags.getEnumSet("CaseInsensitiveColours", Colour.class)) .hasValue(ImmutableSet.of(Colour.YELLOW, Colour.GREEN)); - Truth8.assertThat(flags.getEnumSet("EmptyColours", Colour.class)).hasValue(ImmutableSet.of()); - Truth8.assertThat(flags.getEnumSet("NoSuchColours", Colour.class)).isEmpty(); + assertThat(flags.getEnumSet("EmptyColours", Colour.class)).hasValue(ImmutableSet.of()); + assertThat(flags.getEnumSet("NoSuchColours", Colour.class)).isEmpty(); } @Test diff --git a/core/src/test/java/com/google/errorprone/scanner/ScannerSupplierTest.java b/core/src/test/java/com/google/errorprone/scanner/ScannerSupplierTest.java index 8f01ad69621..80c753da94e 100644 --- a/core/src/test/java/com/google/errorprone/scanner/ScannerSupplierTest.java +++ b/core/src/test/java/com/google/errorprone/scanner/ScannerSupplierTest.java @@ -30,7 +30,6 @@ import com.google.common.truth.FailureMetadata; import com.google.common.truth.MapSubject; import com.google.common.truth.Subject; -import com.google.common.truth.Truth8; import com.google.errorprone.BugCheckerInfo; import com.google.errorprone.BugPattern; import com.google.errorprone.BugPattern.SeverityLevel; @@ -149,7 +148,7 @@ public void plusAllowsDuplicateClassLoading() throws Exception { assertThat(class1).isNotEqualTo(class2); ScannerSupplier ss = ss1.plus(ss2); assertThat(ss.getAllChecks()).hasSize(2); - Truth8.assertThat(ss.getAllChecks().values().stream().map(c -> c.checkerClass())) + assertThat(ss.getAllChecks().values().stream().map(c -> c.checkerClass())) .containsExactly(ArrayEquals.class, class1); assertScanner(ss).hasEnabledChecks(class1); }