/** * Tests {@link Collection#size()}. */ @Test public void testCollectionSize() { resetEmpty(); assertEquals("Size of new Collection is 0.", 0, collection.size()); resetFull(); assertTrue("Size of full collection should be greater than zero", collection.size() > 0); }
/** * Tests {@code toString} on a collection. */ @Test public void testCollectionToString() { resetEmpty(); assertTrue("toString shouldn't return null", collection.toString() != null); resetFull(); assertTrue("toString shouldn't return null", collection.toString() != null); }
/** * Test {@link Collection#clear()}. */ @Test public void testCollectionClear() { if (!isRemoveSupported()) return; resetEmpty(); collection.clear(); // just to make sure it doesn't raise anything verifyAll(); resetFull(); collection.clear(); confirmed.clear(); verifyAll(); }
resetFull(); it1 = collection.iterator(); for (int i = 0; i < collection.size(); i++) {
resetFull(); try { Iterator iter = collection.iterator(); resetFull(); try { Iterator iter = collection.iterator(); resetFull(); try { Iterator iter = collection.iterator(); resetFull(); try { Iterator iter = collection.iterator(); resetFull(); try { Iterator iter = collection.iterator(); resetFull(); try { Iterator iter = collection.iterator();
/** * Tests {@link Collection#isEmpty()}. */ @Test public void testCollectionIsEmpty() { resetEmpty(); assertEquals("New Collection should be empty.", true, collection.isEmpty()); // make sure calls to "isEmpty() don't change anything verifyAll(); resetFull(); assertEquals("Full collection shouldn't be empty", false, collection.isEmpty()); // make sure calls to "isEmpty() don't change anything verifyAll(); }
verifyAll(); resetFull(); try { array = collection.toArray(new Void[0]);
verifyAll(); resetFull(); assertTrue("Collection should change from retainAll empty", collection.retainAll(Collections.EMPTY_SET)); verifyAll(); resetFull(); assertTrue("Collection changed from retainAll other", collection.retainAll(other)); verifyAll(); resetFull(); int size = collection.size(); assertTrue("Collection shouldn't change from retainAll elements", resetFull(); size = collection.size(); int min = (getFullElements().length < 2 ? 0 : 2); resetFull(); HashSet set = new HashSet(elements); size = collection.size();
0, collection.toArray().length); resetFull(); Object[] array = collection.toArray(); assertEquals("Full collection toArray should be same size as " +
resetFull(); assertTrue("Full collection shouldn't contain other elements", !collection.containsAll(col));
resetFull(); try { collection.add(new Object());
resetFull(); try { Iterator iterator = collection.iterator();
/** * Tests {@link Collection#size()}. */ @Test public void testCollectionSize() { resetEmpty(); assertEquals("Size of new Collection is 0.", 0, collection.size()); resetFull(); assertTrue("Size of full collection should be greater than zero", collection.size() > 0); }
/** * Tests {@code toString} on a collection. */ @Test public void testCollectionToString() { resetEmpty(); assertTrue("toString shouldn't return null", collection.toString() != null); resetFull(); assertTrue("toString shouldn't return null", collection.toString() != null); }
/** * Test {@link Collection#clear()}. */ @Test public void testCollectionClear() { if (!isRemoveSupported()) return; resetEmpty(); collection.clear(); // just to make sure it doesn't raise anything verifyAll(); resetFull(); collection.clear(); confirmed.clear(); verifyAll(); }