fail("Collection should not contain a value that the " + "confirmed collection does not have: " + o + "\nTest: " + collection + "\nReal: " + confirmed); if(!matched[i]) { fail("Collection should contain all values that are in the confirmed collection" + "\nTest: " + collection + "\nReal: " + confirmed);
try { collection.clear(); fail("clear should raise UnsupportedOperationException"); } catch (UnsupportedOperationException e) { fail("remove should raise UnsupportedOperationException"); } catch (UnsupportedOperationException e) { fail("removeAll should raise UnsupportedOperationException"); } catch (UnsupportedOperationException e) { fail("removeAll should raise UnsupportedOperationException"); } catch (UnsupportedOperationException e) { iterator.next(); iterator.remove(); fail("iterator.remove should raise UnsupportedOperationException"); } catch (UnsupportedOperationException e) {
try { collection.add(new Object()); fail("Emtpy collection should not support add."); } catch (UnsupportedOperationException e) { fail("Emtpy collection should not support addAll."); } catch (UnsupportedOperationException e) { try { collection.add(new Object()); fail("Full collection should not support add."); } catch (UnsupportedOperationException e) { fail("Full collection should not support addAll."); } catch (UnsupportedOperationException e) {
confirmed.add(o); iter.next(); fail("next after add should raise ConcurrentModification"); } catch (ConcurrentModificationException e) { confirmed.addAll(Arrays.asList(getOtherElements())); iter.next(); fail("next after addAll should raise ConcurrentModification"); } catch (ConcurrentModificationException e) { collection.clear(); iter.next(); fail("next after clear should raise ConcurrentModification"); } catch (ConcurrentModificationException e) { collection.remove(getFullElements()[0]); iter.next(); fail("next after remove should raise ConcurrentModification"); } catch (ConcurrentModificationException e) { collection.removeAll(sublist); iter.next(); fail("next after removeAll should raise ConcurrentModification"); } catch (ConcurrentModificationException e) { collection.retainAll(sublist); iter.next(); fail("next after retainAll should raise ConcurrentModification"); } catch (ConcurrentModificationException e) {
try { collection.iterator().remove(); fail("New iterator.remove should raise IllegalState"); } catch (IllegalStateException e) { iter.hasNext(); iter.remove(); fail("New iterator.remove should raise IllegalState " + "even after hasNext"); } catch (IllegalStateException e) { try { iter.remove(); fail("Second iter.remove should raise IllegalState"); } catch (IllegalStateException e) {
fail("element " + i + " in returned array should be found " + "in the confirmed collection's array");