Replace home-made assertions with equivalent Google Truth calls.
--
MOS_MIGRATED_REVID=107492955
diff --git a/src/test/java/com/google/devtools/build/lib/actions/ArtifactTest.java b/src/test/java/com/google/devtools/build/lib/actions/ArtifactTest.java
index 5eee2a8..ec0b924 100644
--- a/src/test/java/com/google/devtools/build/lib/actions/ArtifactTest.java
+++ b/src/test/java/com/google/devtools/build/lib/actions/ArtifactTest.java
@@ -15,7 +15,6 @@
import static com.google.common.truth.Truth.assertThat;
-import static com.google.devtools.build.lib.testutil.MoreAsserts.assertSameContents;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
@@ -169,7 +168,7 @@
List<String> paths = new ArrayList<>();
MutableActionGraph actionGraph = new MapBasedActionGraph();
Artifact.addExecPaths(getFooBarArtifacts(actionGraph, false), paths);
- assertSameContents(ImmutableList.of("bar1.h", "bar2.h"), paths);
+ assertThat(paths).containsExactlyElementsIn(ImmutableList.of("bar1.h", "bar2.h"));
}
@Test
@@ -178,7 +177,7 @@
MutableActionGraph actionGraph = new MapBasedActionGraph();
Artifact.addExpandedExecPathStrings(getFooBarArtifacts(actionGraph, true), paths,
ActionInputHelper.actionGraphMiddlemanExpander(actionGraph));
- assertSameContents(ImmutableList.of("bar1.h", "bar2.h", "bar3.h"), paths);
+ assertThat(paths).containsExactly("bar1.h", "bar1.h", "bar2.h", "bar3.h");
}
@Test
@@ -187,9 +186,11 @@
MutableActionGraph actionGraph = new MapBasedActionGraph();
Artifact.addExpandedExecPaths(getFooBarArtifacts(actionGraph, true), paths,
ActionInputHelper.actionGraphMiddlemanExpander(actionGraph));
- assertSameContents(ImmutableList.of(
- new PathFragment("bar1.h"), new PathFragment("bar2.h"), new PathFragment("bar3.h")),
- paths);
+ assertThat(paths).containsExactly(
+ new PathFragment("bar1.h"),
+ new PathFragment("bar1.h"),
+ new PathFragment("bar2.h"),
+ new PathFragment("bar3.h"));
}
@Test
@@ -209,7 +210,7 @@
manuallyExpanded.add(artifact);
}
}
- assertSameContents(manuallyExpanded, expanded);
+ assertThat(expanded).containsExactlyElementsIn(manuallyExpanded);
}
@Test
@@ -217,7 +218,7 @@
List<String> paths = new ArrayList<>();
MutableActionGraph actionGraph = new MapBasedActionGraph();
Artifact.addExecPaths(getFooBarArtifacts(actionGraph, false), paths);
- assertSameContents(ImmutableList.of("bar1.h", "bar2.h"), paths);
+ assertThat(paths).containsExactlyElementsIn(ImmutableList.of("bar1.h", "bar2.h"));
}
@Test
@@ -226,7 +227,7 @@
MutableActionGraph actionGraph = new MapBasedActionGraph();
Artifact.addExpandedExecPathStrings(getFooBarArtifacts(actionGraph, true), paths,
ActionInputHelper.actionGraphMiddlemanExpander(actionGraph));
- assertSameContents(ImmutableList.of("bar1.h", "bar2.h", "bar3.h"), paths);
+ assertThat(paths).containsExactly("bar1.h", "bar1.h", "bar2.h", "bar3.h");
}
@Test
@@ -235,9 +236,11 @@
MutableActionGraph actionGraph = new MapBasedActionGraph();
Artifact.addExpandedExecPaths(getFooBarArtifacts(actionGraph, true), paths,
ActionInputHelper.actionGraphMiddlemanExpander(actionGraph));
- assertSameContents(ImmutableList.of(
- new PathFragment("bar1.h"), new PathFragment("bar2.h"), new PathFragment("bar3.h")),
- paths);
+ assertThat(paths).containsExactly(
+ new PathFragment("bar1.h"),
+ new PathFragment("bar1.h"),
+ new PathFragment("bar2.h"),
+ new PathFragment("bar3.h"));
}
@Test
@@ -257,7 +260,7 @@
manuallyExpanded.add(artifact);
}
}
- assertSameContents(manuallyExpanded, expanded);
+ assertThat(expanded).containsExactlyElementsIn(manuallyExpanded);
}
@Test
@@ -309,22 +312,22 @@
new PathFragment("b/c"),
new LabelArtifactOwner(Label.parseAbsoluteUnchecked("//foo:bar"))).serializeToString());
}
-
+
@Test
public void testLongDirname() throws Exception {
String dirName = createDirNameArtifact().getDirname();
-
- assertThat(dirName).isEqualTo("aaa/bbb/ccc");
+
+ assertThat(dirName).isEqualTo("aaa/bbb/ccc");
}
-
+
@Test
public void testDirnameInExecutionDir() throws Exception {
- Artifact artifact = new Artifact(scratch.file("/foo/bar.txt"),
+ Artifact artifact = new Artifact(scratch.file("/foo/bar.txt"),
Root.asDerivedRoot(scratch.dir("/foo")));
-
- assertThat(artifact.getDirname()).isEqualTo(".");
+
+ assertThat(artifact.getDirname()).isEqualTo(".");
}
-
+
@Test
public void testCanConstructPathFromDirAndFilename() throws Exception {
Artifact artifact = createDirNameArtifact();
@@ -333,7 +336,7 @@
assertThat(constructed).isEqualTo("aaa/bbb/ccc/ddd");
}
-
+
private Artifact createDirNameArtifact() throws Exception {
return new Artifact(scratch.file("/aaa/bbb/ccc/ddd"), Root.asDerivedRoot(scratch.dir("/")));
}