From 0cdc4921eab985cafcdbbdf1e4a423c41c8d243a Mon Sep 17 00:00:00 2001 From: Michael Staib Date: Mon, 20 Jun 2016 20:13:27 +0000 Subject: Simplify OutputGroupProviderTest. Avoids constructing and manipulating expected value sets for containsExactlyElementsIn when containsExactly will do. -- MOS_MIGRATED_REVID=125371446 --- .../build/lib/analysis/OutputGroupProviderTest.java | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'src/test/java') 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 outputGroups = determineOutputGroups(ImmutableSet.of("x", "y", "z"), asList("+a")); - Set 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 outputGroups = determineOutputGroups(ImmutableSet.of("x", "y", "z"), asList("-y")); - - Set 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 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 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 expected = new HashSet<>(ImmutableSet.of("x", "y", "z")); - expected.add("a"); - assertThat(outputGroups).containsExactlyElementsIn(expected); + assertThat(outputGroups).containsExactly("x", "y", "z", "a"); } } -- cgit v1.2.3