public void verify() { super.verify(); AbstractTestMap.this.verify(); } }
public void verify() { super.verify(); AbstractTestMap.this.verify(); } }
/** * Verification extension, will check the order of elements, * the sets should already be verified equal. */ public void verify() { super.verify(); // Check that iterator returns elements in order and first() and last() // are consistent Iterator colliter = collection.iterator(); Iterator confiter = confirmed.iterator(); Object first = null; Object last = null; while (colliter.hasNext()) { if (first == null) { first = colliter.next(); last = first; } else { last = colliter.next(); } assertEquals("Element appears to be out of order.", last, confiter.next()); } if (collection.size() > 0) { assertEquals("Incorrect element returned by first().", first, ((SortedSet) collection).first()); assertEquals("Incorrect element returned by last().", last, ((SortedSet) collection).last()); } }
/** * Tests {@link Set#equals(Object)}. */ public void testSetEquals() { resetEmpty(); assertEquals("Empty sets should be equal", getSet(), getConfirmedSet()); verify(); Collection set2 = makeConfirmedCollection(); set2.add("foo"); assertTrue("Empty set shouldn't equal nonempty set", !getSet().equals(set2)); resetFull(); assertEquals("Full sets should be equal", getSet(), getConfirmedSet()); verify(); set2.clear(); set2.addAll(Arrays.asList(getOtherElements())); assertTrue("Sets with different contents shouldn't be equal", !getSet().equals(set2)); }