Use assertThat from Truth instead of Truth8 where possible and qualify other Truth8 calls
The Truth team is moving methods from Truth8 into Truth and for this
migration it's required that classes do not have static imports for
both Truth.assertThat and Thruth8.assertThat.
Change-Id: I7fbc975d5a731ab907e6616bb31ce6ea7b620715
Signed-off-by: Edwin Kempin <ekempin@google.com>
Reviewed-on: https://gerrit-review.googlesource.com/c/plugins/code-owners/+/405560
Tested-by: Zuul <zuul-63@gerritcodereview-ci.iam.gserviceaccount.com>
Reviewed-by: Dmitrii Filippov <dmfilippov@google.com>
diff --git a/javatests/com/google/gerrit/plugins/codeowners/backend/AbstractFileBasedCodeOwnerBackendTest.java b/javatests/com/google/gerrit/plugins/codeowners/backend/AbstractFileBasedCodeOwnerBackendTest.java
index 7ec9295..9dcadd8 100644
--- a/javatests/com/google/gerrit/plugins/codeowners/backend/AbstractFileBasedCodeOwnerBackendTest.java
+++ b/javatests/com/google/gerrit/plugins/codeowners/backend/AbstractFileBasedCodeOwnerBackendTest.java
@@ -15,10 +15,10 @@
package com.google.gerrit.plugins.codeowners.backend;
import static com.google.common.truth.Truth.assertThat;
-import static com.google.common.truth.Truth8.assertThat;
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 +476,7 @@
@Test
public void getFilePathForCodeOwnerConfigKeyWithoutFileName() throws Exception {
CodeOwnerConfig.Key codeOwnerConfigKey = CodeOwnerConfig.Key.create(project, "master", "/");
- assertThat(codeOwnerBackend.getFilePath(codeOwnerConfigKey))
+ Truth8.assertThat(codeOwnerBackend.getFilePath(codeOwnerConfigKey))
.isEqualTo(Paths.get(codeOwnerConfigKey.folderPath() + getFileName()));
}
@@ -484,7 +484,7 @@
public void getFilePathForCodeOwnerConfigKeyWithFileName() throws Exception {
CodeOwnerConfig.Key codeOwnerConfigKey =
CodeOwnerConfig.Key.create(project, "master", "/", getFileName() + "_foo_bar");
- assertThat(codeOwnerBackend.getFilePath(codeOwnerConfigKey))
+ Truth8.assertThat(codeOwnerBackend.getFilePath(codeOwnerConfigKey))
.isEqualTo(
Paths.get(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 42d3696..332ec6b 100644
--- a/javatests/com/google/gerrit/plugins/codeowners/backend/CodeOwnerConfigReferenceTest.java
+++ b/javatests/com/google/gerrit/plugins/codeowners/backend/CodeOwnerConfigReferenceTest.java
@@ -17,9 +17,9 @@
import static com.google.common.truth.PathSubject.paths;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
-import static com.google.common.truth.Truth8.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 java.nio.file.Paths;
@@ -66,7 +66,7 @@
public void relativeFilePathCanBeSpecified() throws Exception {
Path path =
CodeOwnerConfigReference.create(CodeOwnerConfigImportMode.ALL, "foo/OWNERS").filePath();
- assertThat(path).isEqualTo(Paths.get("foo/OWNERS"));
+ Truth8.assertThat(path).isEqualTo(Paths.get("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 433922f..09b40ca 100644
--- a/javatests/com/google/gerrit/plugins/codeowners/backend/CodeOwnerConfigTest.java
+++ b/javatests/com/google/gerrit/plugins/codeowners/backend/CodeOwnerConfigTest.java
@@ -15,9 +15,9 @@
package com.google.gerrit.plugins.codeowners.backend;
import static com.google.common.truth.Truth.assertThat;
-import static com.google.common.truth.Truth8.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;
@@ -88,7 +88,8 @@
String folderPath = "/foo/bar/";
CodeOwnerConfig.Key codeOwnerConfigKey =
CodeOwnerConfig.Key.create(Project.nameKey("project"), "master", folderPath);
- assertThat(codeOwnerConfigKey.filePath("OWNERS")).isEqualTo(Paths.get(folderPath, "OWNERS"));
+ Truth8.assertThat(codeOwnerConfigKey.filePath("OWNERS"))
+ .isEqualTo(Paths.get(folderPath, "OWNERS"));
}
@Test
@@ -98,7 +99,7 @@
CodeOwnerConfig.Key codeOwnerConfigKey =
CodeOwnerConfig.Key.create(
Project.nameKey("project"), "master", folderPath, customFileName);
- assertThat(codeOwnerConfigKey.filePath("OWNERS"))
+ Truth8.assertThat(codeOwnerConfigKey.filePath("OWNERS"))
.isEqualTo(Paths.get(folderPath, customFileName));
}
@@ -141,7 +142,7 @@
TEST_REVISION)
.build();
Path relativizedPath = codeOwnerConfig.relativize(Paths.get("/foo/bar/baz.md"));
- assertThat(relativizedPath).isEqualTo(Paths.get("baz.md"));
+ Truth8.assertThat(relativizedPath).isEqualTo(Paths.get("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 4b73459..1340aea 100644
--- a/javatests/com/google/gerrit/plugins/codeowners/util/JgitPathTest.java
+++ b/javatests/com/google/gerrit/plugins/codeowners/util/JgitPathTest.java
@@ -15,9 +15,9 @@
package com.google.gerrit.plugins.codeowners.util;
import static com.google.common.truth.Truth.assertThat;
-import static com.google.common.truth.Truth8.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 java.nio.file.Paths;
@@ -53,7 +53,7 @@
@Test
public void getPathAsAbsolutePath() throws Exception {
- assertThat(JgitPath.of("foo/bar/OWNERS").getAsAbsolutePath())
+ Truth8.assertThat(JgitPath.of("foo/bar/OWNERS").getAsAbsolutePath())
.isEqualTo(Paths.get("/foo/bar/OWNERS"));
}