@Generates private static <E extends Comparable<E>> ImmutableSortedMultiset<E> generateImmutableSortedMultiset(E freshElement) { return ImmutableSortedMultiset.of(freshElement); }
public void testEquals_immutableMultiset() { Collection<String> c = ImmutableSortedMultiset.of("a", "b", "a"); assertEquals(c, ImmutableSortedMultiset.of("a", "b", "a")); assertEquals(c, ImmutableSortedMultiset.of("a", "a", "b")); assertThat(c).isNotEqualTo(ImmutableSortedMultiset.of("a", "b")); assertThat(c).isNotEqualTo(ImmutableSortedMultiset.of("a", "b", "c", "d")); }
public void testCreation_sevenElements() { Multiset<String> multiset = ImmutableSortedMultiset.of("a", "b", "c", "d", "e", "f", "g"); assertEquals(HashMultiset.create(asList("a", "b", "c", "d", "e", "f", "g")), multiset); }
public void testCreation_fiveElements() { Multiset<String> multiset = ImmutableSortedMultiset.of("a", "b", "c", "d", "e"); assertEquals(HashMultiset.create(asList("a", "b", "c", "d", "e")), multiset); }
public void testCreation_twoElements() { Multiset<String> multiset = ImmutableSortedMultiset.of("a", "b"); assertEquals(HashMultiset.create(asList("a", "b")), multiset); }
public void testCreation_threeElements() { Multiset<String> multiset = ImmutableSortedMultiset.of("a", "b", "c"); assertEquals(HashMultiset.create(asList("a", "b", "c")), multiset); }
public void testCreation_fourElements() { Multiset<String> multiset = ImmutableSortedMultiset.of("a", "b", "c", "d"); assertEquals(HashMultiset.create(asList("a", "b", "c", "d")), multiset); }
public void testCreation_oneElement() { Multiset<String> multiset = ImmutableSortedMultiset.of("a"); assertEquals(HashMultiset.create(asList("a")), multiset); }
public void testCreation_sixElements() { Multiset<String> multiset = ImmutableSortedMultiset.of("a", "b", "c", "d", "e", "f"); assertEquals(HashMultiset.create(asList("a", "b", "c", "d", "e", "f")), multiset); }
public void testIterationOrder() { Collection<String> c = ImmutableSortedMultiset.of("a", "b", "a"); assertThat(c).containsExactly("a", "a", "b").inOrder(); }
public void testCreation_noArgs() { Multiset<String> multiset = ImmutableSortedMultiset.of(); assertTrue(multiset.isEmpty()); }
public void testSerialization_entrySet() { Multiset<String> c = ImmutableSortedMultiset.of("a", "b", "c"); SerializableTester.reserializeAndAssert(c.entrySet()); }
public void testCopyOf_shortcut_empty() { Collection<String> c = ImmutableSortedMultiset.of(); assertSame(c, ImmutableSortedMultiset.copyOf(c)); }
public void testSerialization_empty() { Collection<String> c = ImmutableSortedMultiset.of(); assertSame(c, SerializableTester.reserialize(c)); }
public void testCopyOf_shortcut_singleton() { Collection<String> c = ImmutableSortedMultiset.of("a"); assertSame(c, ImmutableSortedMultiset.copyOf(c)); }
public void testCopyOf_shortcut_immutableMultiset() { Collection<String> c = ImmutableSortedMultiset.of("a", "b", "c"); assertSame(c, ImmutableSortedMultiset.copyOf(c)); }
public void testSerialization_multiple() { Collection<String> c = ImmutableSortedMultiset.of("a", "b", "a"); Collection<String> copy = SerializableTester.reserializeAndAssert(c); assertThat(copy).containsExactly("a", "a", "b").inOrder(); }
public void testSerialization_elementSet() { Multiset<String> c = ImmutableSortedMultiset.of("a", "b", "a"); Collection<String> copy = SerializableTester.reserializeAndAssert(c.elementSet()); assertThat(copy).containsExactly("a", "b").inOrder(); }
public void testAsList() { ImmutableSortedMultiset<String> multiset = ImmutableSortedMultiset.of("a", "a", "b", "b", "b"); ImmutableList<String> list = multiset.asList(); assertEquals(ImmutableList.of("a", "a", "b", "b", "b"), list); SerializableTester.reserializeAndAssert(list); assertEquals(2, list.indexOf("b")); assertEquals(4, list.lastIndexOf("b")); }