Skip to content

Commit

Permalink
Automatic code cleanup.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 602812834
  • Loading branch information
cpovirk authored and Error Prone Team committed Jan 30, 2024
1 parent e45f6b7 commit e6e2706
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
package com.google.errorprone;

import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static org.junit.Assert.assertThrows;

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;
Expand All @@ -38,10 +38,10 @@ public void parseAndGetStringValue() {
.parseFlag("-XepOpt:Other:Arg:More:Parts=Long")
.parseFlag("-XepOpt:EmptyArg=")
.build();
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();
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();
}

@Test
Expand All @@ -54,17 +54,17 @@ public void parseAndGetBoolean() {
.parseFlag("-XepOpt:Arg3=yes")
.parseFlag("-XepOpt:Arg4")
.build();
assertThat(flags.getBoolean("Arg1")).hasValue(true);
assertThat(flags.getBoolean("Arg2")).hasValue(false);
Truth8.assertThat(flags.getBoolean("Arg1")).hasValue(true);
Truth8.assertThat(flags.getBoolean("Arg2")).hasValue(false);
assertThrows(IllegalArgumentException.class, () -> flags.getBoolean("Arg3"));
assertThat(flags.getBoolean("Arg4")).hasValue(true);
assertThat(flags.getBoolean("absent")).isEmpty();
Truth8.assertThat(flags.getBoolean("Arg4")).hasValue(true);
Truth8.assertThat(flags.getBoolean("absent")).isEmpty();
}

@Test
public void parseAndGetImplicitTrue() {
ErrorProneFlags flags = ErrorProneFlags.builder().parseFlag("-XepOpt:SomeArg").build();
assertThat(flags.getBoolean("SomeArg")).hasValue(true);
Truth8.assertThat(flags.getBoolean("SomeArg")).hasValue(true);
}

@Test
Expand All @@ -75,10 +75,10 @@ public void parseAndGetInteger() {
.parseFlag("-XepOpt:Arg2=20.6")
.parseFlag("-XepOpt:Arg3=thirty")
.build();
assertThat(flags.getInteger("Arg1")).hasValue(10);
Truth8.assertThat(flags.getInteger("Arg1")).hasValue(10);
assertThrows(NumberFormatException.class, () -> flags.getInteger("Arg2"));
assertThrows(NumberFormatException.class, () -> flags.getInteger("Arg3"));
assertThat(flags.getInteger("absent")).isEmpty();
Truth8.assertThat(flags.getInteger("absent")).isEmpty();
}

@Test
Expand Down Expand Up @@ -145,13 +145,13 @@ public void enumFlags() {
.parseFlag("-XepOpt:CaseInsensitiveColours=yellow,green")
.parseFlag("-XepOpt:EmptyColours=")
.build();
assertThat(flags.getEnum("Colour", Colour.class)).hasValue(Colour.RED);
assertThat(flags.getEnumSet("Colours", Colour.class))
Truth8.assertThat(flags.getEnum("Colour", Colour.class)).hasValue(Colour.RED);
Truth8.assertThat(flags.getEnumSet("Colours", Colour.class))
.hasValue(ImmutableSet.of(Colour.YELLOW, Colour.GREEN));
assertThat(flags.getEnumSet("CaseInsensitiveColours", Colour.class))
Truth8.assertThat(flags.getEnumSet("CaseInsensitiveColours", Colour.class))
.hasValue(ImmutableSet.of(Colour.YELLOW, Colour.GREEN));
assertThat(flags.getEnumSet("EmptyColours", Colour.class)).hasValue(ImmutableSet.of());
assertThat(flags.getEnumSet("NoSuchColours", Colour.class)).isEmpty();
Truth8.assertThat(flags.getEnumSet("EmptyColours", Colour.class)).hasValue(ImmutableSet.of());
Truth8.assertThat(flags.getEnumSet("NoSuchColours", Colour.class)).isEmpty();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import static com.google.common.truth.Truth.assertAbout;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static com.google.errorprone.BugPattern.SeverityLevel.ERROR;
import static com.google.errorprone.scanner.BuiltInCheckerSuppliers.getSuppliers;
import static org.junit.Assert.assertThrows;
Expand All @@ -31,6 +30,7 @@
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;
Expand Down Expand Up @@ -149,7 +149,7 @@ public void plusAllowsDuplicateClassLoading() throws Exception {
assertThat(class1).isNotEqualTo(class2);
ScannerSupplier ss = ss1.plus(ss2);
assertThat(ss.getAllChecks()).hasSize(2);
assertThat(ss.getAllChecks().values().stream().map(c -> c.checkerClass()))
Truth8.assertThat(ss.getAllChecks().values().stream().map(c -> c.checkerClass()))
.containsExactly(ArrayEquals.class, class1);
assertScanner(ss).hasEnabledChecks(class1);
}
Expand Down

0 comments on commit e6e2706

Please sign in to comment.