/**
  * Insures ConcurrentModificationException is thrown if <code>Iterator.next()</code> is called
  * after invoking <code>setXxx(...)</code> on <code>Dcp</code>.
  */
 @Test(expected = ConcurrentModificationException.class)
 public void testConcurrentModificationSet() {
   Dcp sip = new Dcp();
   Iterator<DcsEntity> i = sip.iterator();
   sip.setCollections(new HashSet<DcsCollection>());
   i.next();
 }
  /**
   * Insures ConcurrentModificationException is thrown if <code>Iterator.next()</code> is called
   * after invoking <code>addXxx(...)</code> on <code>Dcp</code>.
   */
  @Test(expected = ConcurrentModificationException.class)
  public void testConcurrentModificationAdd() {
    Dcp sip = new Dcp();
    DcsCollection col1 = new DcsCollection();
    DcsCollection col2 = new DcsCollection();
    col1.setId("foo");
    col2.setId("bar");

    sip.addCollection(col1);
    Iterator<DcsEntity> i = sip.iterator();
    sip.addCollection(col2);
    i.next();
  }
  /** Test where the iterators in the implementation are next to each other in the switch. */
  @Test
  public void testDcpIteratorSimple() {
    Dcp sip = new Dcp();
    sip.addCollection(new DcsCollection());
    sip.addDeliverableUnit(new DcsDeliverableUnit());

    Iterator<DcsEntity> underTest = sip.iterator();

    assertTrue(underTest.hasNext());
    assertNotNull(underTest.next());
    assertTrue(underTest.hasNext());
    assertNotNull(underTest.next());
    assertFalse(underTest.hasNext());

    try {
      underTest.next();
      fail("Expected a NoSuchElementException");
    } catch (NoSuchElementException expected) {
    }
  }