diff --git a/core/src/test/java/com/google/googlejavaformat/java/CommandLineOptionsParserTest.java b/core/src/test/java/com/google/googlejavaformat/java/CommandLineOptionsParserTest.java index 1a4ed09b4..2b7f3af3a 100644 --- a/core/src/test/java/com/google/googlejavaformat/java/CommandLineOptionsParserTest.java +++ b/core/src/test/java/com/google/googlejavaformat/java/CommandLineOptionsParserTest.java @@ -15,12 +15,12 @@ package com.google.googlejavaformat.java; import static com.google.common.truth.Truth.assertThat; -import static com.google.common.truth.Truth8.assertThat; import static java.nio.charset.StandardCharsets.UTF_8; import static org.junit.Assert.fail; import com.google.common.collect.ImmutableList; import com.google.common.collect.Range; +import com.google.common.truth.Truth8; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -181,11 +181,11 @@ public void paramsFile() throws IOException { @Test public void assumeFilename() { - assertThat( + Truth8.assertThat( CommandLineOptionsParser.parse(Arrays.asList("--assume-filename", "Foo.java")) .assumeFilename()) .hasValue("Foo.java"); - assertThat(CommandLineOptionsParser.parse(Arrays.asList("Foo.java")).assumeFilename()) + Truth8.assertThat(CommandLineOptionsParser.parse(Arrays.asList("Foo.java")).assumeFilename()) .isEmpty(); } diff --git a/core/src/test/java/com/google/googlejavaformat/java/GoogleJavaFormatToolProviderTest.java b/core/src/test/java/com/google/googlejavaformat/java/GoogleJavaFormatToolProviderTest.java index 3d41a0733..3fab11770 100644 --- a/core/src/test/java/com/google/googlejavaformat/java/GoogleJavaFormatToolProviderTest.java +++ b/core/src/test/java/com/google/googlejavaformat/java/GoogleJavaFormatToolProviderTest.java @@ -15,8 +15,8 @@ package com.google.googlejavaformat.java; import static com.google.common.truth.Truth.assertThat; -import static com.google.common.truth.Truth8.assertThat; +import com.google.common.truth.Truth8; import java.io.PrintWriter; import java.io.StringWriter; import java.util.ServiceLoader; @@ -33,7 +33,7 @@ public class GoogleJavaFormatToolProviderTest { public void testUsageOutputAfterLoadingViaToolName() { String name = "google-java-format"; - assertThat( + Truth8.assertThat( ServiceLoader.load(ToolProvider.class).stream() .map(ServiceLoader.Provider::get) .map(ToolProvider::name)) diff --git a/core/src/test/java/com/google/googlejavaformat/java/GoogleJavaFormatToolTest.java b/core/src/test/java/com/google/googlejavaformat/java/GoogleJavaFormatToolTest.java index 691bb2234..e73b84cdb 100644 --- a/core/src/test/java/com/google/googlejavaformat/java/GoogleJavaFormatToolTest.java +++ b/core/src/test/java/com/google/googlejavaformat/java/GoogleJavaFormatToolTest.java @@ -15,9 +15,9 @@ package com.google.googlejavaformat.java; import static com.google.common.truth.Truth.assertThat; -import static com.google.common.truth.Truth8.assertThat; import static java.nio.charset.StandardCharsets.UTF_8; +import com.google.common.truth.Truth8; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; @@ -35,7 +35,7 @@ public class GoogleJavaFormatToolTest { public void testUsageOutputAfterLoadingViaToolName() { String name = "google-java-format"; - assertThat( + Truth8.assertThat( ServiceLoader.load(Tool.class).stream() .map(ServiceLoader.Provider::get) .map(Tool::name)) diff --git a/core/src/test/java/com/google/googlejavaformat/java/TypeNameClassifierTest.java b/core/src/test/java/com/google/googlejavaformat/java/TypeNameClassifierTest.java index 3270bc64e..be47e9f4e 100644 --- a/core/src/test/java/com/google/googlejavaformat/java/TypeNameClassifierTest.java +++ b/core/src/test/java/com/google/googlejavaformat/java/TypeNameClassifierTest.java @@ -15,9 +15,9 @@ package com.google.googlejavaformat.java; import static com.google.common.truth.Truth.assertThat; -import static com.google.common.truth.Truth8.assertThat; import com.google.common.base.Splitter; +import com.google.common.truth.Truth8; import com.google.googlejavaformat.java.TypeNameClassifier.JavaCaseFormat; import java.util.Optional; import org.junit.Test; @@ -52,25 +52,26 @@ private static Optional getPrefix(String qualifiedName) { @Test public void typePrefixLength() { - assertThat(getPrefix("fieldName")).isEmpty(); - assertThat(getPrefix("CONST")).isEmpty(); - assertThat(getPrefix("ClassName")).hasValue(0); - assertThat(getPrefix("com.ClassName")).hasValue(1); - assertThat(getPrefix("ClassName.foo")).hasValue(1); - assertThat(getPrefix("com.ClassName.foo")).hasValue(2); - assertThat(getPrefix("ClassName.foo.bar")).hasValue(1); - assertThat(getPrefix("com.ClassName.foo.bar")).hasValue(2); - assertThat(getPrefix("ClassName.CONST")).hasValue(1); - assertThat(getPrefix("ClassName.varName")).hasValue(1); - assertThat(getPrefix("ClassName.Inner.varName")).hasValue(2); - assertThat(getPrefix("com.R.foo")).hasValue(2); + Truth8.assertThat(getPrefix("fieldName")).isEmpty(); + Truth8.assertThat(getPrefix("CONST")).isEmpty(); + Truth8.assertThat(getPrefix("ClassName")).hasValue(0); + Truth8.assertThat(getPrefix("com.ClassName")).hasValue(1); + Truth8.assertThat(getPrefix("ClassName.foo")).hasValue(1); + Truth8.assertThat(getPrefix("com.ClassName.foo")).hasValue(2); + Truth8.assertThat(getPrefix("ClassName.foo.bar")).hasValue(1); + Truth8.assertThat(getPrefix("com.ClassName.foo.bar")).hasValue(2); + Truth8.assertThat(getPrefix("ClassName.CONST")).hasValue(1); + Truth8.assertThat(getPrefix("ClassName.varName")).hasValue(1); + Truth8.assertThat(getPrefix("ClassName.Inner.varName")).hasValue(2); + Truth8.assertThat(getPrefix("com.R.foo")).hasValue(2); } @Test public void ambiguousClass() { - assertThat(getPrefix("com.google.security.acl.proto2api.ACL.Entry.newBuilder")).hasValue(7); + Truth8.assertThat(getPrefix("com.google.security.acl.proto2api.ACL.Entry.newBuilder")) + .hasValue(7); // A human would probably identify this as "class-shaped", but just looking // at the case we have to assume it could be something like `field1.field2.CONST`. - assertThat(getPrefix("com.google.security.acl.proto2api.ACL.newBuilder")).isEmpty(); + Truth8.assertThat(getPrefix("com.google.security.acl.proto2api.ACL.newBuilder")).isEmpty(); } }