/**
   * Test setSignal().
   *
   * @throws InvocationTargetException test failure
   * @throws InterruptedException test failure
   */
  public void testSetSignal() throws InterruptedException, InvocationTargetException {

    Model.getCommonBehaviorHelper().setSignal(elem, signals[0]);
    ThreadHelper.synchronize();
    // One can only do this by changing target,
    // so let's simulate that:
    Object dummy = Model.getCommonBehaviorFactory().createReception();
    model.targetSet(
        new TargetEvent(this, TargetEvent.TARGET_SET, new Object[] {elem}, new Object[] {dummy}));
    model.targetSet(
        new TargetEvent(this, TargetEvent.TARGET_SET, new Object[] {dummy}, new Object[] {elem}));
    ThreadHelper.synchronize();
    assertTrue(model.getSelectedItem() == signals[0]);
  }
  /**
   * Test removing signals.
   *
   * @throws InvocationTargetException test failure
   * @throws InterruptedException test failure
   */
  public void testRemoveSignal() throws InterruptedException, InvocationTargetException {

    Model.getUmlFactory().delete(signals[NO_OF_ELEMENTS - 1]);
    ThreadHelper.synchronize();
    assertEquals(NO_OF_ELEMENTS - 1, model.getSize());
    assertTrue(!model.contains(signals[NO_OF_ELEMENTS - 1]));
  }
 /*
  * @see junit.framework.TestCase#setUp()
  */
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   InitializeModel.initializeDefault();
   ns = Model.getModelManagementFactory().createModel();
   elem = Model.getCoreFactory().buildClass(ns);
   model = new UMLModelElementClientDependencyListModel();
   model.setTarget(elem);
   ThreadHelper.synchronize();
 }
 /** Tests the programmatically adding of multiple elements to the list. */
 public void testAddMultiple() throws Exception {
   Object[] suppliers = new Object[NO_OF_ELEMENTS];
   Object[] dependencies = new Object[NO_OF_ELEMENTS];
   for (int i = 0; i < NO_OF_ELEMENTS; i++) {
     suppliers[i] = Model.getCoreFactory().buildClass(ns);
     dependencies[i] = Model.getCoreFactory().buildDependency(elem, suppliers[i]);
   }
   ThreadHelper.synchronize();
   assertEquals(NO_OF_ELEMENTS, model.getSize());
   assertEquals(model.getElementAt(NO_OF_ELEMENTS / 2), dependencies[NO_OF_ELEMENTS / 2]);
   assertEquals(model.getElementAt(0), dependencies[0]);
   assertEquals(model.getElementAt(NO_OF_ELEMENTS - 1), dependencies[NO_OF_ELEMENTS - 1]);
 }
 /*
  * @see junit.framework.TestCase#setUp()
  */
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   InitializeModel.initializeDefault();
   new InitProfileSubsystem().init();
   Project p = ProjectManager.getManager().getCurrentProject();
   elem = Model.getCommonBehaviorFactory().createReception();
   signals = new Object[NO_OF_ELEMENTS];
   Object m = Model.getModelManagementFactory().createModel();
   Collection roots = new ArrayList();
   roots.add(m);
   p.setRoots(roots);
   Model.getCoreHelper().setNamespace(elem, m);
   for (int i = 0; i < NO_OF_ELEMENTS; i++) {
     signals[i] = Model.getCommonBehaviorFactory().createSignal();
     Model.getCoreHelper().addOwnedElement(m, signals[i]);
   }
   model = new UMLReceptionSignalComboBoxModel();
   model.targetSet(new TargetEvent(this, "set", new Object[0], new Object[] {elem}));
   ThreadHelper.synchronize();
 }