@Override protected void assertMoreInvariants(Map<K, V> map) { // TODO: can these be moved to MapInterfaceTest? for (Entry<K, V> entry : map.entrySet()) { assertEquals(entry.getKey() + "=" + entry.getValue(), entry.toString()); } assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString()); assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString()); assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString()); assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString()); assertEquals(MinimalSet.from(map.entrySet()), map.entrySet()); assertEquals(Sets.newHashSet(map.keySet()), map.keySet()); }
@Override protected void assertMoreInvariants(Map<K, V> map) { // TODO: can these be moved to MapInterfaceTest? for (Entry<K, V> entry : map.entrySet()) { assertEquals(entry.getKey() + "=" + entry.getValue(), entry.toString()); } assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString()); assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString()); assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString()); assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString()); assertEquals(MinimalSet.from(map.entrySet()), map.entrySet()); assertEquals(new HashSet<K>(map.keySet()), map.keySet()); }
@CollectionSize.Require(absent = CollectionSize.ZERO) public void testEquals_otherSetWithDifferentElements() { Collection<E> elements = getSampleElements(getNumElements() - 1); elements.add(getSubjectGenerator().samples().e3()); assertFalse( "A Set should not equal another Set containing different elements.", getSet().equals(MinimalSet.from(elements))); }
@CollectionSize.Require(absent = CollectionSize.ZERO) @CollectionFeature.Require(ALLOWS_NULL_VALUES) public void testEquals_containingNull() { Collection<E> elements = getSampleElements(getNumElements() - 1); elements.add(null); collection = getSubjectGenerator().create(elements.toArray()); assertTrue( "A Set should equal any other Set containing the same elements," + " even if some elements are null.", getSet().equals(MinimalSet.from(elements))); }
@CollectionSize.Require(absent = CollectionSize.ZERO) public void testEquals_otherContainsNull() { Collection<E> elements = getSampleElements(getNumElements() - 1); elements.add(null); Set<E> other = MinimalSet.from(elements); assertFalse( "Two Sets should not be equal if exactly one of them contains null.", getSet().equals(other)); }
@CollectionSize.Require(absent = CollectionSize.ZERO) public void testEquals_smallerSet() { Collection<E> fewerElements = getSampleElements(getNumElements() - 1); assertFalse( "Sets of different sizes should not be equal.", getSet().equals(MinimalSet.from(fewerElements))); }
@CollectionSize.Require(absent = CollectionSize.ZERO) public void testEquals_otherSetWithDifferentElements() { Collection<E> elements = getSampleElements(getNumElements() - 1); elements.add(getSubjectGenerator().samples().e3()); assertFalse( "A Set should not equal another Set containing different elements.", getSet().equals(MinimalSet.from(elements)) ); }
@CollectionSize.Require(absent = CollectionSize.ZERO) @CollectionFeature.Require(ALLOWS_NULL_VALUES) public void testEquals_containingNull() { Collection<E> elements = getSampleElements(getNumElements() - 1); elements.add(null); collection = getSubjectGenerator().create(elements.toArray()); assertTrue("A Set should equal any other Set containing the same elements," + " even if some elements are null.", getSet().equals(MinimalSet.from(elements))); }
public void testEquals_set() { assertFalse("A List should never equal a Set.", getList().equals(MinimalSet.from(getList()))); }
public void testEquals_otherSetWithSameElements() { assertTrue( "A Set should equal any other Set containing the same elements.", getSet().equals(MinimalSet.from(getSampleElements()))); }
public void testEquals_largerSet() { Collection<E> moreElements = getSampleElements(getNumElements() + 1); assertFalse( "Sets of different sizes should not be equal.", getSet().equals(MinimalSet.from(moreElements))); }
@CollectionSize.Require(absent = CollectionSize.ZERO) public void testEquals_smallerSet() { Collection<E> fewerElements = getSampleElements(getNumElements() - 1); assertFalse("Sets of different sizes should not be equal.", getSet().equals(MinimalSet.from(fewerElements))); }
public void testEquals_largerSet() { Collection<E> moreElements = getSampleElements(getNumElements() + 1); assertFalse("Sets of different sizes should not be equal.", getSet().equals(MinimalSet.from(moreElements))); }