Package org.eclipse.uml2.uml

Examples of org.eclipse.uml2.uml.Type


    EnumDeclaration ed = enumGenerator.generateEnum(clazz, ast, cu);

    EList<Property> properties = mock(EList.class);
    Iterator<Property> propertyIter = mock(Iterator.class);
    Property property = mock(Property.class);
    Type type = mock(Type.class);
    String name = "type";

    EList<Comment> comments = mock(EList.class,
        Answers.RETURNS_DEEP_STUBS.get());

    when(clazz.getAttributes()).thenReturn(properties);
    when(properties.iterator()).thenReturn(propertyIter);
    when(propertyIter.hasNext()).thenReturn(true).thenReturn(false);
    when(propertyIter.next()).thenReturn(property);
    when(property.getType()).thenReturn(type);
    when(property.getName()).thenReturn(name);
    when(property.getUpper()).thenReturn(1);
    when(property.getLower()).thenReturn(1);
    when(property.getOwnedComments()).thenReturn(comments);
    when(type.getName()).thenReturn("String");
    when(type.getQualifiedName()).thenReturn("String");

    enumGenerator.generateAttributes(clazz, ast, ed);

    assertEquals("public enum Company {; String type;\n}\n", cu.toString());
  }
View Full Code Here


    EList<Property> secondProperties = mock(EList.class);
    Iterator<Property> secondPropertyIter = mock(Iterator.class);

    Property property = mock(Property.class);
    Type type = mock(Type.class);
    String name = "type";

    EList<Comment> comments = mock(EList.class,
        Answers.RETURNS_DEEP_STUBS.get());

    when(clazz.getAttributes()).thenReturn(firstProperties).thenReturn(
        secondProperties);
    when(firstProperties.iterator()).thenReturn(firstPropertyIter);
    when(firstPropertyIter.hasNext()).thenReturn(true).thenReturn(false);
    when(firstPropertyIter.next()).thenReturn(property);

    when(secondProperties.iterator()).thenReturn(secondPropertyIter);
    when(secondPropertyIter.hasNext()).thenReturn(true).thenReturn(false);
    when(secondPropertyIter.next()).thenReturn(property);

    when(property.getType()).thenReturn(type);
    when(property.getName()).thenReturn(name);
    when(property.getUpper()).thenReturn(1);
    when(property.getLower()).thenReturn(1);
    when(property.getOwnedComments()).thenReturn(comments);
    when(type.getName()).thenReturn("String");
    when(type.getQualifiedName()).thenReturn("String");

    enumGenerator.generateConstructor(clazz, ast, ed);

    assertEquals(
        "public enum Company {; private Company(String type){\n  this.type=type;\n}\n}\n",
View Full Code Here

    EList<Property> secondProperties = mock(EList.class);
    Iterator<Property> secondPropertyIter = mock(Iterator.class);

    Property firstProperty = mock(Property.class);
    Type firstType = mock(Type.class);
    String firstName = "type";

    Property secondProperty = mock(Property.class);
    Type secondType = mock(Type.class);
    String secondName = "count";

    EList<Comment> comments = mock(EList.class,
        Answers.RETURNS_DEEP_STUBS.get());

    when(clazz.getAttributes()).thenReturn(firstProperties).thenReturn(
        secondProperties);
    when(firstProperties.iterator()).thenReturn(firstPropertyIter);
    when(firstPropertyIter.hasNext()).thenReturn(true).thenReturn(true)
        .thenReturn(false);
    when(firstPropertyIter.next()).thenReturn(firstProperty).thenReturn(
        secondProperty);

    when(secondProperties.iterator()).thenReturn(secondPropertyIter);
    when(secondPropertyIter.hasNext()).thenReturn(true).thenReturn(true)
        .thenReturn(false);
    when(secondPropertyIter.next()).thenReturn(firstProperty).thenReturn(
        secondProperty);

    when(firstProperty.getType()).thenReturn(firstType);
    when(firstProperty.getName()).thenReturn(firstName);
    when(firstProperty.getUpper()).thenReturn(1);
    when(firstProperty.getLower()).thenReturn(1);
    when(firstProperty.getOwnedComments()).thenReturn(comments);
    when(firstType.getName()).thenReturn("String");
    when(firstType.getQualifiedName()).thenReturn("String");

    when(secondProperty.getType()).thenReturn(secondType);
    when(secondProperty.getName()).thenReturn(secondName);
    when(secondProperty.getUpper()).thenReturn(1);
    when(secondProperty.getLower()).thenReturn(1);
    when(secondProperty.getOwnedComments()).thenReturn(comments);
    when(secondType.getName()).thenReturn("Integer");
    when(secondType.getQualifiedName()).thenReturn("Integer");

    enumGenerator.generateConstructor(clazz, ast, ed);

    assertEquals(
        "public enum Company {; private Company(String type,Integer count){\n  this.type=type;\n  this.count=count;\n}\n}\n",
View Full Code Here

    EList<Property> properties = mock(EList.class);
    Iterator<Property> propertyIter = mock(Iterator.class);
    Property propertyName = mock(Property.class);
    String name = "name";
    Type typeName = mock(Type.class);
    Property propertyCount = mock(Property.class);
    String count = "count";
    Type typeCount = mock(Type.class);

    EList<Comment> comments = mock(EList.class,
        Answers.RETURNS_DEEP_STUBS.get());

    when(clazz.getAttributes()).thenReturn(properties);
    when(properties.iterator()).thenReturn(propertyIter);
    when(propertyIter.hasNext()).thenReturn(true).thenReturn(true)
        .thenReturn(false);
    when(propertyIter.next()).thenReturn(propertyName).thenReturn(
        propertyCount);

    when(propertyName.getType()).thenReturn(typeName);
    when(propertyName.getName()).thenReturn(name);
    when(propertyName.getUpper()).thenReturn(1);
    when(propertyName.getLower()).thenReturn(1);
    when(propertyName.getOwnedComments()).thenReturn(comments);
    when(typeName.getName()).thenReturn("String");
    when(typeName.getQualifiedName()).thenReturn("String");

    when(propertyCount.getType()).thenReturn(typeCount);
    when(propertyCount.getName()).thenReturn(count);
    when(propertyCount.getUpper()).thenReturn(1);
    when(propertyCount.getLower()).thenReturn(1);
    when(propertyCount.getOwnedComments()).thenReturn(comments);
    when(typeCount.getName()).thenReturn("Integer");
    when(typeCount.getQualifiedName()).thenReturn("Integer");

    enumGenerator.generateContructorParameters(clazz, ast, md);

    ed.bodyDeclarations().add(md);
View Full Code Here

    Slot slot1 = mock(Slot.class);
    Slot slot2 = mock(Slot.class);

    Property property1 = mock(Property.class);
    Property property2 = mock(Property.class);
    Type type1 = mock(Type.class);
    Type type2 = mock(Type.class);

    EList<ValueSpecification> valueSpecifications1 = mock(EList.class);
    Iterator<ValueSpecification> valueSpecificationIter1 = mock(Iterator.class);
    EList<ValueSpecification> valueSpecifications2 = mock(EList.class);
    Iterator<ValueSpecification> valueSpecificationIter2 = mock(Iterator.class);
    ValueSpecification valueSpecification1 = mock(ValueSpecification.class);
    ValueSpecification valueSpecification2 = mock(ValueSpecification.class);

    when(enumeration.getOwnedLiterals()).thenReturn(enumLiterals);
    when(enumLiterals.iterator()).thenReturn(enumIter);
    when(enumIter.hasNext()).thenReturn(true).thenReturn(false);
    when(enumIter.next()).thenReturn(enumLiteral);
    when(enumLiteral.getName()).thenReturn("Home");

    when(enumLiteral.getSlots()).thenReturn(slots);
    when(slots.iterator()).thenReturn(slotIter);
    when(slotIter.hasNext()).thenReturn(true).thenReturn(true)
        .thenReturn(false);
    when(slotIter.next()).thenReturn(slot1).thenReturn(slot2);
    when(slot1.getDefiningFeature()).thenReturn(property1);
    when(slot2.getDefiningFeature()).thenReturn(property2);

    when(property1.getType()).thenReturn(type1);
    when(property2.getType()).thenReturn(type2);
    when(property1.getName()).thenReturn("type");
    when(property2.getName()).thenReturn("name");
    when(type1.getName()).thenReturn("boolean");
    when(type2.getName()).thenReturn("String");

    when(slot1.getValues()).thenReturn(valueSpecifications1);
    when(slot2.getValues()).thenReturn(valueSpecifications2);
    when(valueSpecifications1.iterator()).thenReturn(
        valueSpecificationIter1);
View Full Code Here

    Slot slot1 = mock(Slot.class);
    Slot slot2 = mock(Slot.class);

    Property property1 = mock(Property.class);
    Property property2 = mock(Property.class);
    Type type1 = mock(Type.class);
    Type type2 = mock(Type.class);

    EList<ValueSpecification> valueSpecifications1 = mock(EList.class);
    Iterator<ValueSpecification> valueSpecificationIter1 = mock(Iterator.class);
    EList<ValueSpecification> valueSpecifications2 = mock(EList.class);
    Iterator<ValueSpecification> valueSpecificationIter2 = mock(Iterator.class);
    ValueSpecification valueSpecification1 = mock(ValueSpecification.class);
    ValueSpecification valueSpecification2 = mock(ValueSpecification.class);

    when(enumeration.getOwnedLiterals()).thenReturn(enumLiterals);
    when(enumLiterals.iterator()).thenReturn(enumIter);
    when(enumIter.hasNext()).thenReturn(true).thenReturn(false);
    when(enumIter.next()).thenReturn(enumLiteral);
    when(enumLiteral.getName()).thenReturn("Home");

    when(enumLiteral.getSlots()).thenReturn(slots1).thenReturn(slots2);
    when(slots1.iterator()).thenReturn(slotIter1);
    when(slots2.iterator()).thenReturn(slotIter2);
    when(slotIter1.hasNext()).thenReturn(true).thenReturn(true)
        .thenReturn(false);
    when(slotIter2.hasNext()).thenReturn(true).thenReturn(true)
        .thenReturn(false);
    when(slotIter1.next()).thenReturn(slot1).thenReturn(slot2);
    when(slotIter2.next()).thenReturn(slot1).thenReturn(slot2);
    when(slot1.getDefiningFeature()).thenReturn(property1);
    when(slot2.getDefiningFeature()).thenReturn(property2);

    when(property1.getType()).thenReturn(type1);
    when(property2.getType()).thenReturn(type2);
    when(property1.getName()).thenReturn("type");
    when(property2.getName()).thenReturn("name");
    when(type1.getName()).thenReturn("boolean");
    when(type2.getName()).thenReturn("String");

    when(slot1.getValues()).thenReturn(valueSpecifications1);
    when(slot2.getValues()).thenReturn(valueSpecifications2);
    when(valueSpecifications1.iterator()).thenReturn(
        valueSpecificationIter1);
View Full Code Here

    EList<Parameter> params = mock(EList.class,
        Answers.RETURNS_DEEP_STUBS.get());
    Iterator<Parameter> paramIterator = mock(Iterator.class);
    Parameter parameter = mock(Parameter.class,
        Answers.RETURNS_DEEP_STUBS.get());
    Type type = mock(Type.class, Answers.RETURNS_DEEP_STUBS.get());

    Map<String, String> types = new HashMap<String, String>();
    types.put("umlTypeName", "Collection<de::test::Company>");
    types.put("umlQualifiedTypeName",
        "Data::datatype::Collection<de::test::Company>");

    when(operation.getOwnedParameters()).thenReturn(params);
    when(params.iterator()).thenReturn(paramIterator);
    when(paramIterator.hasNext()).thenReturn(true, false);
    when(paramIterator.next()).thenReturn(parameter);
    when(parameter.getDirection()).thenReturn(
        ParameterDirectionKind.get(ParameterDirectionKind.IN));
    when(parameter.getType()).thenReturn(type);
    when(parameter.getName()).thenReturn("companies");
    when(type.getName()).thenReturn("Collection<Company>");
    when(type.getQualifiedName()).thenReturn(
        "Data::datatype::Collection<Company>");
    when(dataTypeUtils.isParameterizedType(Mockito.anyString()))
        .thenReturn(true);
    when(
        umlHelper
View Full Code Here

    EList<Operation> operations = mock(EList.class,
        Answers.RETURNS_DEEP_STUBS.get());
    Operation operation = mock(Operation.class,
        Answers.RETURNS_DEEP_STUBS.get());
    Type operationType = mock(Type.class, Answers.RETURNS_DEEP_STUBS.get());
    Iterator<Operation> iteratorOperation = mock(Iterator.class);
    EList<Type> raisedExceptions = mock(EList.class,
        Answers.RETURNS_DEEP_STUBS.get());
    Iterator<Type> iteratorException = mock(Iterator.class);
    Type exceptionType = mock(Type.class, Answers.RETURNS_DEEP_STUBS.get());

    when(clazz.getOperations()).thenReturn(operations);
    when(operations.iterator()).thenReturn(iteratorOperation);
    when(iteratorOperation.hasNext()).thenReturn(true, false);
    when(iteratorOperation.next()).thenReturn(operation);
    when(operation.getName()).thenReturn("calculateMe");
    when(operation.getType()).thenReturn(operationType);
    when(operation.getRaisedExceptions()).thenReturn(raisedExceptions);
    when(raisedExceptions.iterator()).thenReturn(iteratorException);
    when(iteratorException.hasNext()).thenReturn(true, false);
    when(iteratorException.next()).thenReturn(exceptionType);

    when(exceptionType.getQualifiedName()).thenReturn(
        "de::test::CalculatorException");
    when(operationType.getQualifiedName()).thenReturn(
        "de::test::Calculator");
    when(operationType.getName()).thenReturn("Calculator");
View Full Code Here

    EList<Parameter> parameters = mock(EList.class,
        Answers.RETURNS_DEEP_STUBS.get());
    Iterator<Parameter> paramIterator = mock(Iterator.class);
    Parameter parameter = mock(Parameter.class,
        Answers.RETURNS_DEEP_STUBS.get());
    Type type = mock(Type.class, Answers.RETURNS_DEEP_STUBS.get());

    when(operation.getOwnedParameters()).thenReturn(parameters);
    when(parameters.iterator()).thenReturn(paramIterator);
    when(paramIterator.hasNext()).thenReturn(true, false);
    when(paramIterator.next()).thenReturn(parameter);
    when(parameter.getDirection()).thenReturn(
        ParameterDirectionKind.IN_LITERAL);
    when(parameter.getType()).thenReturn(type);
    when(parameter.getName()).thenReturn("person");
    when(parameter.getUpper()).thenReturn(0);
    when(type.getName()).thenReturn("Person");
    when(type.getQualifiedName()).thenReturn("de.component.Person");

    interfaceGenerator.generateMethodParams(ast, td, operation, md);

    assertEquals("void calculateAge(de.component.Person person);\n",
        md.toString());
View Full Code Here

    EList<Parameter> parameters = mock(EList.class,
        Answers.RETURNS_DEEP_STUBS.get());
    Iterator<Parameter> paramIterator = mock(Iterator.class);
    Parameter parameter = mock(Parameter.class,
        Answers.RETURNS_DEEP_STUBS.get());
    Type type = mock(Type.class, Answers.RETURNS_DEEP_STUBS.get());

    when(operation.getOwnedParameters()).thenReturn(parameters);
    when(parameters.iterator()).thenReturn(paramIterator);
    when(paramIterator.hasNext()).thenReturn(true, false);
    when(paramIterator.next()).thenReturn(parameter);
    when(parameter.getDirection()).thenReturn(
        ParameterDirectionKind.IN_LITERAL);
    when(parameter.getType()).thenReturn(type);
    when(parameter.getName()).thenReturn("person");
    when(parameter.getUpper()).thenReturn(0);
    when(type.getName()).thenReturn("Person<Integer>");
    when(type.getQualifiedName())
        .thenReturn("de.component.Person<Integer>");

    interfaceGenerator.generateMethodParams(ast, td, operation, md);

    assertEquals(
View Full Code Here

TOP

Related Classes of org.eclipse.uml2.uml.Type

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.