Package org.tinyuml.model

Examples of org.tinyuml.model.UmlClass


 
  /**
   * Initial state.
   */
  public void testInitial() {
    UmlClass umlclass = UmlClass.getPrototype();
    assertFalse(umlclass.isAbstract());
    assertEquals(0, umlclass.getMethods().size());
  }
View Full Code Here


  /**
   * Tests the setAbstract method.
   */
  public void testSetters() {
    Mock mockListener = mock(UmlModelElementListener.class);
    UmlClass umlclass = UmlClass.getPrototype();
    UmlClass clonedClass = (UmlClass) UmlClass.getPrototype().clone();
    clonedClass.addModelElementListener((UmlModelElementListener)
      mockListener.proxy());
    mockListener.expects(once()).method("elementChanged").with(eq(clonedClass));
    clonedClass.setAbstract(true);
    assertTrue(clonedClass.isAbstract());
    assertFalse(umlclass.isAbstract());
  }
View Full Code Here

  /**
   * Tests the setMethods() method.
   */
  public void testSetMethods() {
    Mock mockListener = mock(UmlModelElementListener.class);
    UmlClass clonedClass = (UmlClass) UmlClass.getPrototype().clone();
    clonedClass.addModelElementListener((UmlModelElementListener)
      mockListener.proxy());
    List<UmlProperty> methodList = new ArrayList<UmlProperty>();
    UmlProperty method1 = (UmlProperty) UmlProperty.getPrototype().clone();
    UmlProperty method2 = (UmlProperty) UmlProperty.getPrototype().clone();
    UmlProperty method3 = (UmlProperty) UmlProperty.getPrototype().clone();
    methodList.add(method1);
    methodList.add(method2);
    methodList.add(method3);
   
    mockListener.expects(once()).method("elementChanged").with(eq(clonedClass));
    clonedClass.setMethods(methodList);
    assertEquals(methodList, clonedClass.getMethods());
  }
View Full Code Here

  /**
   * Tests the setAttributes() method.
   */
  public void testSetAttributes() {
    Mock mockListener = mock(UmlModelElementListener.class);
    UmlClass clonedClass = (UmlClass) UmlClass.getPrototype().clone();
    clonedClass.addModelElementListener((UmlModelElementListener)
      mockListener.proxy());
    List<UmlProperty> attributeList = new ArrayList<UmlProperty>();
    UmlProperty attrib1 = (UmlProperty) UmlProperty.getPrototype().clone();
    UmlProperty attrib2 = (UmlProperty) UmlProperty.getPrototype().clone();
    UmlProperty attrib3 = (UmlProperty) UmlProperty.getPrototype().clone();
    attributeList.add(attrib1);
    attributeList.add(attrib2);
    attributeList.add(attrib3);
   
    mockListener.expects(once()).method("elementChanged").with(eq(clonedClass));
    clonedClass.setAttributes(attributeList);
    assertEquals(attributeList, clonedClass.getAttributes());
  }
View Full Code Here

  /**
   * Tests the setStereotypes() method.
   */
  public void testSetStereotypes() {
    Mock mockListener = mock(UmlModelElementListener.class);
    UmlClass clonedClass = (UmlClass) UmlClass.getPrototype().clone();
    clonedClass.addModelElementListener((UmlModelElementListener)
      mockListener.proxy());
    List<UmlStereotype> stereotypeList = new ArrayList<UmlStereotype>();
    UmlStereotype stereo1 = (UmlStereotype) UmlStereotype.getPrototype().clone();
    UmlStereotype stereo2 = (UmlStereotype) UmlStereotype.getPrototype().clone();
    UmlStereotype stereo3 = (UmlStereotype) UmlStereotype.getPrototype().clone();
    stereotypeList.add(stereo1);
    stereotypeList.add(stereo2);
    stereotypeList.add(stereo3);
   
    mockListener.expects(once()).method("elementChanged").with(eq(clonedClass));
    clonedClass.setStereotypes(stereotypeList);
    assertEquals(stereotypeList, clonedClass.getStereotypes());
  }
View Full Code Here

      UmlStereotype stereo = (UmlStereotype) UmlStereotype.getPrototype().clone();
      stereo.setName("stereotype" + i);
      stereotypes.add(stereo);
    }
   
    UmlClass original = UmlClass.getPrototype();
    original.setAttributes(attributes);
    original.setMethods(methods);
    original.setStereotypes(stereotypes);
   
    UmlClass cloned = (UmlClass) original.clone();
    assertTrue(original.getAttributes() != cloned.getAttributes());
    assertEquals(original.getAttributes().size(),
      cloned.getAttributes().size());
    for (int i = 0; i < cloned.getAttributes().size(); i++) {
      assertTrue(original.getAttributes().get(i) ==
        cloned.getAttributes().get(i));
    }
   
    assertTrue(original.getMethods() != cloned.getMethods());
    assertEquals(original.getMethods().size(), cloned.getMethods().size());
    for (int i = 0; i < cloned.getMethods().size(); i++) {
      assertTrue(original.getMethods().get(i) ==
        cloned.getMethods().get(i));
    }
   
    assertTrue(original.getStereotypes() != cloned.getStereotypes());
    assertEquals(original.getStereotypes().size(),
      cloned.getStereotypes().size());
    for (int i = 0; i < cloned.getStereotypes().size(); i++) {
      assertTrue(original.getStereotypes().get(i) ==
        cloned.getStereotypes().get(i));
    }
  }
View Full Code Here

   * {@inheritDoc}
   */
  public void editProperties(DiagramElement element) {
    if (element instanceof ClassElement) {
      ClassElement classElement = (ClassElement) element;
      UmlClass umlclass = (UmlClass) classElement.getModelElement();
      EditClassDialog dialog = new EditClassDialog(frame, classElement, true);
      dialog.setLocationRelativeTo(frame);
      dialog.setVisible(true);
      if (dialog.isOk()) {
        umlclass.setAbstract(dialog.classIsAbstract());
        classElement.setShowOperations(dialog.showOperations());
        classElement.setShowAttributes(dialog.showAttributes());
        classElement.setShowStereotypes(dialog.showStereotypes());
        umlclass.setName(dialog.getName());
        umlclass.setMethods(dialog.getMethods());
        umlclass.setAttributes(dialog.getAttributes());
        umlclass.setStereotypes(dialog.getStereotypes());
        redraw();
      }
    } else if (element instanceof Association) {
      Association association = (Association) element;
      EditAssociationDialog dialog = new EditAssociationDialog(frame,
View Full Code Here

 
  /**
   * Initial state.
   */
  public void testInitial() {
    UmlClass umlclass = UmlClass.getInstance();
    assertFalse(umlclass.isAbstract());
    assertEquals(0, umlclass.getMethods().size());
  }
View Full Code Here

  /**
   * Tests the setAbstract method.
   */
  public void testSetters() {
    Mock mockListener = mock(UmlModelElementListener.class);
    UmlClass umlclass = UmlClass.getInstance();
    UmlClass clonedClass = (UmlClass) UmlClass.getInstance().clone();
    clonedClass.addModelElementListener((UmlModelElementListener)
      mockListener.proxy());
    mockListener.expects(once()).method("elementChanged").with(eq(clonedClass));
    clonedClass.setAbstract(true);
    assertTrue(clonedClass.isAbstract());
    assertFalse(umlclass.isAbstract());
  }
View Full Code Here

  /**
   * Tests the setMethods() method.
   */
  public void testSetMethods() {
    Mock mockListener = mock(UmlModelElementListener.class);
    UmlClass clonedClass = (UmlClass) UmlClass.getInstance().clone();
    clonedClass.addModelElementListener((UmlModelElementListener)
      mockListener.proxy());
    List<UmlProperty> methodList = new ArrayList<UmlProperty>();
    methodList.add(new UmlProperty("method1"));
    methodList.add(new UmlProperty("method2"));
    methodList.add(new UmlProperty("method3"));
   
    mockListener.expects(once()).method("elementChanged").with(eq(clonedClass));
    clonedClass.setMethods(methodList);
    assertEquals(methodList, clonedClass.getMethods());
  }
View Full Code Here

TOP

Related Classes of org.tinyuml.model.UmlClass

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.