cleanup work in guava tests

This commit is contained in:
eugenp 2014-11-04 13:02:20 +02:00
parent 12b73b9ff3
commit 477a9b90e1
1 changed files with 12 additions and 10 deletions

View File

@ -111,8 +111,10 @@ public class GuavaCollectionTypesTest {
assertThat(immutable, contains("John", "Adam", "Jane", "Tom")); assertThat(immutable, contains("John", "Adam", "Jane", "Tom"));
} }
// sets
@Test @Test
public void whenCalculateUnion_thenCorrect() { public void whenCalculateUnionOfSets_thenCorrect() {
final Set<Character> first = ImmutableSet.of('a', 'b', 'c'); final Set<Character> first = ImmutableSet.of('a', 'b', 'c');
final Set<Character> second = ImmutableSet.of('b', 'c', 'd'); final Set<Character> second = ImmutableSet.of('b', 'c', 'd');
@ -120,15 +122,6 @@ public class GuavaCollectionTypesTest {
assertThat(union, containsInAnyOrder('a', 'b', 'c', 'd')); assertThat(union, containsInAnyOrder('a', 'b', 'c', 'd'));
} }
@Test
public void whenCalculateIntersection_thenCorrect() {
final Set<Character> first = ImmutableSet.of('a', 'b', 'c');
final Set<Character> second = ImmutableSet.of('b', 'c', 'd');
final Set<Character> intersection = Sets.intersection(first, second);
assertThat(intersection, containsInAnyOrder('b', 'c'));
}
@Test @Test
public void whenCalculateSetsProduct_thenCorrect() { public void whenCalculateSetsProduct_thenCorrect() {
final Set<Character> first = ImmutableSet.of('a', 'b'); final Set<Character> first = ImmutableSet.of('a', 'b');
@ -146,6 +139,15 @@ public class GuavaCollectionTypesTest {
assertThat(joined, containsInAnyOrder("a c", "a d", "b c", "b d")); assertThat(joined, containsInAnyOrder("a c", "a d", "b c", "b d"));
} }
@Test
public void whenCalculatingSetIntersection_thenCorrect() {
final Set<Character> first = ImmutableSet.of('a', 'b', 'c');
final Set<Character> second = ImmutableSet.of('b', 'c', 'd');
final Set<Character> intersection = Sets.intersection(first, second);
assertThat(intersection, containsInAnyOrder('b', 'c'));
}
@Test @Test
public void whenCalculatePowerSet_thenCorrect() { public void whenCalculatePowerSet_thenCorrect() {
final Set<Character> chars = ImmutableSet.of('a', 'b'); final Set<Character> chars = ImmutableSet.of('a', 'b');