Migrate from `Truth8` to `Truth`, and restore static imports. This removes the qualified `assertThat` calls that I'd introduced in 3f2a11b5a25774b30b7094108343578746929256: As of Truth 1.4.2, it's safe to use static import again (once you migrate off `Truth8`). Change-Id: Ib86c5e1193e2f1e2019fee906b4aa8cc05cbcc89 Reviewed-on: https://gerrit-review.googlesource.com/c/plugins/code-owners/+/413677 Tested-by: Zuul <zuul-63@gerritcodereview-ci.iam.gserviceaccount.com> Reviewed-by: Chris Poucet <poucet@google.com>
diff --git a/javatests/com/google/gerrit/plugins/codeowners/acceptance/testsuite/CodeOwnerConfigOperationsImplTest.java b/javatests/com/google/gerrit/plugins/codeowners/acceptance/testsuite/CodeOwnerConfigOperationsImplTest.java index 85da5bd..7d41dbc 100644 --- a/javatests/com/google/gerrit/plugins/codeowners/acceptance/testsuite/CodeOwnerConfigOperationsImplTest.java +++ b/javatests/com/google/gerrit/plugins/codeowners/acceptance/testsuite/CodeOwnerConfigOperationsImplTest.java
@@ -20,7 +20,6 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; -import com.google.common.truth.Truth8; import com.google.gerrit.entities.BranchNameKey; import com.google.gerrit.entities.Project; import com.google.gerrit.entities.RefNames; @@ -176,7 +175,7 @@ .folderPath(folderPath) .addCodeOwnerEmail(admin.email()) .create(); - Truth8.assertThat(codeOwnerConfigKey.folderPath()).isEqualTo(Path.of(folderPath)); + assertThat(codeOwnerConfigKey.folderPath()).isEqualTo(Path.of(folderPath)); assertThat(getCodeOwnerConfigFromServer(codeOwnerConfigKey)) .hasCodeOwnerSetsThat() .onlyElement()
diff --git a/javatests/com/google/gerrit/plugins/codeowners/backend/AbstractFileBasedCodeOwnerBackendTest.java b/javatests/com/google/gerrit/plugins/codeowners/backend/AbstractFileBasedCodeOwnerBackendTest.java index 7731055..5281391 100644 --- a/javatests/com/google/gerrit/plugins/codeowners/backend/AbstractFileBasedCodeOwnerBackendTest.java +++ b/javatests/com/google/gerrit/plugins/codeowners/backend/AbstractFileBasedCodeOwnerBackendTest.java
@@ -18,7 +18,6 @@ import static com.google.gerrit.plugins.codeowners.testing.CodeOwnerConfigSubject.assertThatOptional; import static com.google.gerrit.testing.GerritJUnit.assertThrows; -import com.google.common.truth.Truth8; import com.google.gerrit.acceptance.config.GerritConfig; import com.google.gerrit.common.Nullable; import com.google.gerrit.entities.BranchNameKey; @@ -476,7 +475,7 @@ @Test public void getFilePathForCodeOwnerConfigKeyWithoutFileName() throws Exception { CodeOwnerConfig.Key codeOwnerConfigKey = CodeOwnerConfig.Key.create(project, "master", "/"); - Truth8.assertThat(codeOwnerBackend.getFilePath(codeOwnerConfigKey)) + assertThat(codeOwnerBackend.getFilePath(codeOwnerConfigKey)) .isEqualTo(Path.of(codeOwnerConfigKey.folderPath() + getFileName())); } @@ -484,7 +483,7 @@ public void getFilePathForCodeOwnerConfigKeyWithFileName() throws Exception { CodeOwnerConfig.Key codeOwnerConfigKey = CodeOwnerConfig.Key.create(project, "master", "/", getFileName() + "_foo_bar"); - Truth8.assertThat(codeOwnerBackend.getFilePath(codeOwnerConfigKey)) + assertThat(codeOwnerBackend.getFilePath(codeOwnerConfigKey)) .isEqualTo(Path.of(codeOwnerConfigKey.folderPath() + codeOwnerConfigKey.fileName().get())); }
diff --git a/javatests/com/google/gerrit/plugins/codeowners/backend/CodeOwnerConfigReferenceTest.java b/javatests/com/google/gerrit/plugins/codeowners/backend/CodeOwnerConfigReferenceTest.java index f82b4cf..8b7141f 100644 --- a/javatests/com/google/gerrit/plugins/codeowners/backend/CodeOwnerConfigReferenceTest.java +++ b/javatests/com/google/gerrit/plugins/codeowners/backend/CodeOwnerConfigReferenceTest.java
@@ -19,7 +19,6 @@ import static com.google.common.truth.Truth.assertWithMessage; import static com.google.gerrit.testing.GerritJUnit.assertThrows; -import com.google.common.truth.Truth8; import com.google.gerrit.plugins.codeowners.acceptance.AbstractCodeOwnersTest; import java.nio.file.Path; import java.util.Optional; @@ -65,7 +64,7 @@ public void relativeFilePathCanBeSpecified() throws Exception { Path path = CodeOwnerConfigReference.create(CodeOwnerConfigImportMode.ALL, "foo/OWNERS").filePath(); - Truth8.assertThat(path).isEqualTo(Path.of("foo/OWNERS")); + assertThat(path).isEqualTo(Path.of("foo/OWNERS")); assertThat(path.isAbsolute()).isFalse(); } }
diff --git a/javatests/com/google/gerrit/plugins/codeowners/backend/CodeOwnerConfigTest.java b/javatests/com/google/gerrit/plugins/codeowners/backend/CodeOwnerConfigTest.java index 764a576..84b6da9 100644 --- a/javatests/com/google/gerrit/plugins/codeowners/backend/CodeOwnerConfigTest.java +++ b/javatests/com/google/gerrit/plugins/codeowners/backend/CodeOwnerConfigTest.java
@@ -17,7 +17,6 @@ import static com.google.common.truth.Truth.assertThat; import static com.google.gerrit.testing.GerritJUnit.assertThrows; -import com.google.common.truth.Truth8; import com.google.gerrit.entities.BranchNameKey; import com.google.gerrit.entities.Project; import com.google.gerrit.entities.RefNames; @@ -87,8 +86,7 @@ String folderPath = "/foo/bar/"; CodeOwnerConfig.Key codeOwnerConfigKey = CodeOwnerConfig.Key.create(Project.nameKey("project"), "master", folderPath); - Truth8.assertThat(codeOwnerConfigKey.filePath("OWNERS")) - .isEqualTo(Path.of(folderPath, "OWNERS")); + assertThat(codeOwnerConfigKey.filePath("OWNERS")).isEqualTo(Path.of(folderPath, "OWNERS")); } @Test @@ -98,7 +96,7 @@ CodeOwnerConfig.Key codeOwnerConfigKey = CodeOwnerConfig.Key.create( Project.nameKey("project"), "master", folderPath, customFileName); - Truth8.assertThat(codeOwnerConfigKey.filePath("OWNERS")) + assertThat(codeOwnerConfigKey.filePath("OWNERS")) .isEqualTo(Path.of(folderPath, customFileName)); } @@ -141,7 +139,7 @@ TEST_REVISION) .build(); Path relativizedPath = codeOwnerConfig.relativize(Path.of("/foo/bar/baz.md")); - Truth8.assertThat(relativizedPath).isEqualTo(Path.of("baz.md")); + assertThat(relativizedPath).isEqualTo(Path.of("baz.md")); } private static CodeOwnerConfig.Builder createCodeOwnerBuilder() {
diff --git a/javatests/com/google/gerrit/plugins/codeowners/util/JgitPathTest.java b/javatests/com/google/gerrit/plugins/codeowners/util/JgitPathTest.java index 9571146..75f60be 100644 --- a/javatests/com/google/gerrit/plugins/codeowners/util/JgitPathTest.java +++ b/javatests/com/google/gerrit/plugins/codeowners/util/JgitPathTest.java
@@ -17,7 +17,6 @@ import static com.google.common.truth.Truth.assertThat; import static com.google.gerrit.testing.GerritJUnit.assertThrows; -import com.google.common.truth.Truth8; import com.google.gerrit.plugins.codeowners.acceptance.AbstractCodeOwnersTest; import java.nio.file.Path; import org.junit.Test; @@ -52,7 +51,7 @@ @Test public void getPathAsAbsolutePath() throws Exception { - Truth8.assertThat(JgitPath.of("foo/bar/OWNERS").getAsAbsolutePath()) + assertThat(JgitPath.of("foo/bar/OWNERS").getAsAbsolutePath()) .isEqualTo(Path.of("/foo/bar/OWNERS")); }