diff options
author | 2016-06-20 20:13:27 +0000 | |
---|---|---|
committer | 2016-06-21 09:58:29 +0000 | |
commit | 0cdc4921eab985cafcdbbdf1e4a423c41c8d243a (patch) | |
tree | 780c296c99f4b0c6d2a160c6b633a3d22c30c88a /src/test/java | |
parent | 152feb04f940385edaab01435454188488509fb3 (diff) |
Simplify OutputGroupProviderTest.
Avoids constructing and manipulating expected value sets
for containsExactlyElementsIn when containsExactly will do.
--
MOS_MIGRATED_REVID=125371446
Diffstat (limited to 'src/test/java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/analysis/OutputGroupProviderTest.java | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/OutputGroupProviderTest.java b/src/test/java/com/google/devtools/build/lib/analysis/OutputGroupProviderTest.java index c56f0dddaf..a6857b7089 100644 --- a/src/test/java/com/google/devtools/build/lib/analysis/OutputGroupProviderTest.java +++ b/src/test/java/com/google/devtools/build/lib/analysis/OutputGroupProviderTest.java @@ -24,7 +24,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import java.util.HashSet; import java.util.Set; /** @@ -43,18 +42,13 @@ public final class OutputGroupProviderTest { @Test public void testDetermineOutputGroupsAddsToDefaults() throws Exception { Set<String> outputGroups = determineOutputGroups(ImmutableSet.of("x", "y", "z"), asList("+a")); - Set<String> expected = new HashSet<>(ImmutableSet.of("x", "y", "z")); - expected.add("a"); - assertThat(outputGroups).containsExactlyElementsIn(expected); + assertThat(outputGroups).containsExactly("x", "y", "z", "a"); } @Test public void testDetermineOutputGroupsRemovesFromDefaults() throws Exception { Set<String> outputGroups = determineOutputGroups(ImmutableSet.of("x", "y", "z"), asList("-y")); - - Set<String> expected = new HashSet<>(ImmutableSet.of("x", "y", "z")); - expected.remove("y"); - assertThat(outputGroups).containsExactlyElementsIn(expected); + assertThat(outputGroups).containsExactly("x", "z"); } @Test @@ -70,19 +64,17 @@ public final class OutputGroupProviderTest { Set<String> outputGroups = determineOutputGroups(ImmutableSet.of("x", "y", "z"), asList("-foo")); // "foo" doesn't exist, but that shouldn't be a problem. - assertThat(outputGroups).containsExactlyElementsIn(ImmutableSet.of("x", "y", "z")); + assertThat(outputGroups).containsExactly("x", "y", "z"); } @Test public void testDetermineOutputGroupsRemovesPreviouslyAddedGroup() throws Exception { Set<String> outputGroups; outputGroups = determineOutputGroups(ImmutableSet.of("x", "y", "z"), asList("+a", "-a")); - assertThat(outputGroups).containsExactlyElementsIn(ImmutableSet.of("x", "y", "z")); + assertThat(outputGroups).containsExactly("x", "y", "z"); // Order matters here. outputGroups = determineOutputGroups(ImmutableSet.of("x", "y", "z"), asList("-a", "+a")); - Set<String> expected = new HashSet<>(ImmutableSet.of("x", "y", "z")); - expected.add("a"); - assertThat(outputGroups).containsExactlyElementsIn(expected); + assertThat(outputGroups).containsExactly("x", "y", "z", "a"); } } |