/**
  * Tests AssociationCompartmentExtractor#updateFirstAssociationEnd(GraphElement) for failure.
  *
  * <p>It tests the case that when newElement is null and expects IllegalArgumentException.
  *
  * @throws Exception to JUnit
  */
 public void testUpdateFirstAssociationEnd_NullNewElement() throws Exception {
   try {
     extractor.updateFirstAssociationEnd(null);
     fail("IllegalArgumentException expected.");
   } catch (IllegalArgumentException iae) {
     // good
   }
 }
 /**
  * Tests AssociationCompartmentExtractor#updateFirstAssociationEnd(GraphElement) for failure.
  *
  * <p>It tests the case that when newElement is invalid and expects IllegalArgumentException.
  *
  * @throws Exception to JUnit
  */
 public void testUpdateFirstAssociationEnd_InvalidNewElement() throws Exception {
   try {
     extractor.updateFirstAssociationEnd(getStereotypeNodeForUpdate());
     fail("CompartmentMalformedException expected.");
   } catch (CompartmentMalformedException e) {
     // good
   }
 }
  /**
   * Tests AssociationCompartmentExtractor#updateFirstAssociationEnd(GraphElement) for failure.
   *
   * <p>Expects CompartmentNotFoundException.
   *
   * @throws Exception to JUnit
   */
  public void testUpdateFirstAssociationEnd_CompartmentNotFoundException() throws Exception {
    edge.clearContaineds();

    try {
      extractor.updateFirstAssociationEnd(getAssociationEndNodeForUpdate());
      fail("CompartmentNotFoundException expected.");
    } catch (CompartmentNotFoundException e) {
      // good
    }
  }
  /**
   * Tests AssociationCompartmentExtractor#updateFirstAssociationEnd(GraphElement) for accuracy.
   *
   * <p>Verify : UpdateFirstAssociationEnd is correct.
   *
   * @throws Exception to JUnit
   */
  public void testUpdateFirstAssociationEnd() throws Exception {
    GraphElement newElement = getAssociationEndNodeForUpdate();

    extractor.updateFirstAssociationEnd(newElement);

    assertSame(
        "The Second Association End compartment should be updated.",
        newElement,
        extractor.extractFirstAssociationEnd());
  }
  /**
   * Tests AssociationCompartmentExtractor#updateFirstAssociationEnd(GraphElement) for failure.
   *
   * <p>Expects CompartmentMalformedException.
   *
   * @throws Exception to JUnit
   */
  public void testUpdateFirstAssociationEnd_CompartmentMalformedException() throws Exception {
    GraphElement element = (GraphElement) edge.getContaineds().get(0);
    element.setSemanticModel(TestHelper.createSimpleSemanticModel("Invalid"));

    try {
      extractor.updateFirstAssociationEnd(getAssociationEndNodeForUpdate());
      fail("CompartmentMalformedException expected.");
    } catch (CompartmentMalformedException e) {
      // good
    }
  }