Merge pull request #67 from Doha2012/master

Modify Class GuavaCollectionTypesTest
This commit is contained in:
Eugen 2014-11-03 13:10:14 +02:00
commit 12b73b9ff3
1 changed files with 22 additions and 0 deletions

View File

@ -120,6 +120,15 @@ public class GuavaCollectionTypesTest {
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
public void whenCalculateSetsProduct_thenCorrect() {
final Set<Character> first = ImmutableSet.of('a', 'b');
@ -137,6 +146,19 @@ public class GuavaCollectionTypesTest {
assertThat(joined, containsInAnyOrder("a c", "a d", "b c", "b d"));
}
@Test
public void whenCalculatePowerSet_thenCorrect() {
final Set<Character> chars = ImmutableSet.of('a', 'b');
final Set<Set<Character>> result = Sets.powerSet(chars);
final Set<Character> empty = ImmutableSet.<Character> builder().build();
final Set<Character> a = ImmutableSet.of('a');
final Set<Character> b = ImmutableSet.of('b');
final Set<Character> aB = ImmutableSet.of('a', 'b');
assertThat(result, contains(empty, a, b, aB));
}
@Test
public void whenCreateRangeOfIntegersSet_thenCreated() {
final int start = 10;