Simplify OutputGroupProviderTest.
Avoids constructing and manipulating expected value sets
for containsExactlyElementsIn when containsExactly will do.
--
MOS_MIGRATED_REVID=125371446
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 c56f0dd..a6857b7 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.runner.RunWith;
import org.junit.runners.JUnit4;
-import java.util.HashSet;
import java.util.Set;
/**
@@ -43,18 +42,13 @@
@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 @@
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");
}
}