@SuppressWarnings("unchecked") @Test public void testGenerateAssociationEndUpperCardinalityMultiplesIsOrdered() { AST ast = AST.newAST(AST.JLS3); ast.newCompilationUnit(); TypeDeclaration td = ast.newTypeDeclaration(); td.setInterface(true); Modifier modifier = ast .newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD); td.modifiers().add(modifier); td.setName(ast.newSimpleName("Company")); Property property = mock(Property.class); MethodDeclaration mdGetter = ast.newMethodDeclaration(); mdGetter.setName(ast.newSimpleName("getCompanies")); String umlQualifiedTypeName = "test.de.Company"; String umlTypeName = "Company"; when(property.isOrdered()).thenReturn(true); when(property.isUnique()).thenReturn(false); interfaceGenerator.generateAssociationEndUpperCardinalityMultiples(ast, td, property, mdGetter, umlTypeName, umlQualifiedTypeName); assertEquals("java.util.List<test.de.Company>", mdGetter .getReturnType2().toString()); }
public void generateAssociationEndUpperCardinalityMultiples(AST ast, AbstractTypeDeclaration td, Property property, MethodDeclaration mdGetter, String umlTypeName, String umlQualifiedTypeName) { if (property.isOrdered() && !property.isUnique()) { jdtHelper.createReturnTypeAsCollection(ast, td, mdGetter, umlTypeName, umlQualifiedTypeName, sourceDirectoryPackageName, JdtHelper.JAVA_UTIL_LIST); } else if (property.isUnique() && !property.isOrdered()) { jdtHelper.createReturnTypeAsCollection(ast, td, mdGetter, umlTypeName, umlQualifiedTypeName, sourceDirectoryPackageName, JdtHelper.JAVA_UTIL_SET); } else if (property.isUnique() && property.isOrdered()) { jdtHelper.createReturnTypeAsCollection(ast, td, mdGetter, umlTypeName, umlQualifiedTypeName, sourceDirectoryPackageName, JdtHelper.JAVA_UTIL_SORTEDSET); } else { jdtHelper.createReturnTypeAsCollection(ast, td, mdGetter, umlTypeName, umlQualifiedTypeName, sourceDirectoryPackageName, JdtHelper.JAVA_UTIL_COLLECTION); } }
InterfaceGenerator { public void generateAssociationEndUpperCardinalityMultiples(AST ast, AbstractTypeDeclaration td, Property property, MethodDeclaration mdGetter, String umlTypeName, String umlQualifiedTypeName) { if (property.isOrdered() && !property.isUnique()) { jdtHelper.createReturnTypeAsCollection(ast, td, mdGetter, umlTypeName, umlQualifiedTypeName, sourceDirectoryPackageName, JdtHelper.JAVA_UTIL_LIST); } else if (property.isUnique() && !property.isOrdered()) { jdtHelper.createReturnTypeAsCollection(ast, td, mdGetter, umlTypeName, umlQualifiedTypeName, sourceDirectoryPackageName, JdtHelper.JAVA_UTIL_SET); } else if (property.isUnique() && property.isOrdered()) { jdtHelper.createReturnTypeAsCollection(ast, td, mdGetter, umlTypeName, umlQualifiedTypeName, sourceDirectoryPackageName, JdtHelper.JAVA_UTIL_SORTEDSET); } else { jdtHelper.createReturnTypeAsCollection(ast, td, mdGetter, umlTypeName, umlQualifiedTypeName, sourceDirectoryPackageName, JdtHelper.JAVA_UTIL_COLLECTION); } } }
InterfaceGenerator { public void generateAssociationEndUpperCardinalityMultiples(AST ast, AbstractTypeDeclaration td, Property property, MethodDeclaration mdGetter, String umlTypeName, String umlQualifiedTypeName) { if (property.isOrdered() && !property.isUnique()) { jdtHelper.createReturnTypeAsCollection(ast, td, mdGetter, umlTypeName, umlQualifiedTypeName, sourceDirectoryPackageName, JdtHelper.JAVA_UTIL_LIST); } else if (property.isUnique() && !property.isOrdered()) { jdtHelper.createReturnTypeAsCollection(ast, td, mdGetter, umlTypeName, umlQualifiedTypeName, sourceDirectoryPackageName, JdtHelper.JAVA_UTIL_SET); } else if (property.isUnique() && property.isOrdered()) { jdtHelper.createReturnTypeAsCollection(ast, td, mdGetter, umlTypeName, umlQualifiedTypeName, sourceDirectoryPackageName, JdtHelper.JAVA_UTIL_SORTEDSET); } else { jdtHelper.createReturnTypeAsCollection(ast, td, mdGetter, umlTypeName, umlQualifiedTypeName, sourceDirectoryPackageName, JdtHelper.JAVA_UTIL_COLLECTION); } }  }
InterfaceGenerator { public void generateAssociationEndUpperCardinalityMultiples(AST ast, AbstractTypeDeclaration td, Property property, MethodDeclaration mdGetter, String umlTypeName, String umlQualifiedTypeName) { if (property.isOrdered() && !property.isUnique()) { jdtHelper.createReturnTypeAsCollection(ast, td, mdGetter, umlTypeName, umlQualifiedTypeName, sourceDirectoryPackageName, JdtHelper.JAVA_UTIL_LIST); } else if (property.isUnique() && !property.isOrdered()) { jdtHelper.createReturnTypeAsCollection(ast, td, mdGetter, umlTypeName, umlQualifiedTypeName, sourceDirectoryPackageName, JdtHelper.JAVA_UTIL_SET); } else if (property.isUnique() && property.isOrdered()) { jdtHelper.createReturnTypeAsCollection(ast, td, mdGetter, umlTypeName, umlQualifiedTypeName, sourceDirectoryPackageName, JdtHelper.JAVA_UTIL_SORTEDSET); } else { jdtHelper.createReturnTypeAsCollection(ast, td, mdGetter, umlTypeName, umlQualifiedTypeName, sourceDirectoryPackageName, JdtHelper.JAVA_UTIL_COLLECTION); } }  CompilationUnit generateInterface(Classifier clazz,
			String sourceDirectoryPackageName); @SuppressWarnings("unchecked") void generatePackageJavadoc(AST ast,
			PackageDeclaration packageDeclaration, String... comment); void generateGettersSetters(Classifier clazz, AST ast,
			TypeDeclaration td); MethodDeclaration generateGetterMethod(AST ast,
			AbstractTypeDeclaration td, Property property, String umlTypeName,
			String umlQualifiedTypeName); MethodDeclaration generateGetterMethod(AST ast,
			AbstractTypeDeclaration td, Property property, String umlTypeName,
			String umlQualifiedTypeName, String sourceDirectoryPackageName); @SuppressWarnings("unchecked") void generateSetterMethod(AST ast, AbstractTypeDeclaration td,
			Property property, String umlTypeName, String umlQualifiedTypeName); void generateAssociationEndUpperCardinalityMultiples(AST ast,
			AbstractTypeDeclaration td, Property property,
			MethodDeclaration mdGetter, String umlTypeName,
			String umlQualifiedTypeName); void generateAssociationEndUpperCardinalityMultiples(AST ast,
			AbstractTypeDeclaration td, Operation operation,
			MethodDeclaration mdGetter, String umlTypeName,
			String umlQualifiedTypeName); void generateAssociationEndUpperCardinalityMultiples(AST ast,
			AbstractTypeDeclaration td, Parameter parameter,
			MethodDeclaration md, String umlTypeName,
			String umlQualifiedTypeName, String umlPropertyName); void generateGetterSetterJavadoc(AST ast, Property property,
			MethodDeclaration methodDeclaration); @SuppressWarnings("unchecked") TypeDeclaration generateClass(Classifier clazz, AST ast,
			CompilationUnit cu); void generateClassJavadoc(Classifier clazz, AST ast,
			AbstractTypeDeclaration td); @SuppressWarnings("unchecked") void generateClassTemplateParams(Classifier clazz, AST ast,
			TypeDeclaration td); void generatePackage(Classifier clazz, AST ast, CompilationUnit cu); void generateMethods(Classifier clazz, AST ast, TypeDeclaration td); @SuppressWarnings("unchecked") void generateMethodTemplateParams(AST ast, Operation operation,
			MethodDeclaration md); void generateMethodJavadoc(AST ast, Operation operation,
			MethodDeclaration md); void generateMethodParams(AST ast, TypeDeclaration td,
			Operation operation, MethodDeclaration md); }
InterfaceGenerator { public void generateAssociationEndUpperCardinalityMultiples(AST ast, AbstractTypeDeclaration td, Property property, MethodDeclaration mdGetter, String umlTypeName, String umlQualifiedTypeName) { if (property.isOrdered() && !property.isUnique()) { jdtHelper.createReturnTypeAsCollection(ast, td, mdGetter, umlTypeName, umlQualifiedTypeName, sourceDirectoryPackageName, JdtHelper.JAVA_UTIL_LIST); } else if (property.isUnique() && !property.isOrdered()) { jdtHelper.createReturnTypeAsCollection(ast, td, mdGetter, umlTypeName, umlQualifiedTypeName, sourceDirectoryPackageName, JdtHelper.JAVA_UTIL_SET); } else if (property.isUnique() && property.isOrdered()) { jdtHelper.createReturnTypeAsCollection(ast, td, mdGetter, umlTypeName, umlQualifiedTypeName, sourceDirectoryPackageName, JdtHelper.JAVA_UTIL_SORTEDSET); } else { jdtHelper.createReturnTypeAsCollection(ast, td, mdGetter, umlTypeName, umlQualifiedTypeName, sourceDirectoryPackageName, JdtHelper.JAVA_UTIL_COLLECTION); } }  CompilationUnit generateInterface(Classifier clazz,
			String sourceDirectoryPackageName); @SuppressWarnings("unchecked") void generatePackageJavadoc(AST ast,
			PackageDeclaration packageDeclaration, String... comment); void generateGettersSetters(Classifier clazz, AST ast,
			TypeDeclaration td); MethodDeclaration generateGetterMethod(AST ast,
			AbstractTypeDeclaration td, Property property, String umlTypeName,
			String umlQualifiedTypeName); MethodDeclaration generateGetterMethod(AST ast,
			AbstractTypeDeclaration td, Property property, String umlTypeName,
			String umlQualifiedTypeName, String sourceDirectoryPackageName); @SuppressWarnings("unchecked") void generateSetterMethod(AST ast, AbstractTypeDeclaration td,
			Property property, String umlTypeName, String umlQualifiedTypeName); void generateAssociationEndUpperCardinalityMultiples(AST ast,
			AbstractTypeDeclaration td, Property property,
			MethodDeclaration mdGetter, String umlTypeName,
			String umlQualifiedTypeName); void generateAssociationEndUpperCardinalityMultiples(AST ast,
			AbstractTypeDeclaration td, Operation operation,
			MethodDeclaration mdGetter, String umlTypeName,
			String umlQualifiedTypeName); void generateAssociationEndUpperCardinalityMultiples(AST ast,
			AbstractTypeDeclaration td, Parameter parameter,
			MethodDeclaration md, String umlTypeName,
			String umlQualifiedTypeName, String umlPropertyName); void generateGetterSetterJavadoc(AST ast, Property property,
			MethodDeclaration methodDeclaration); @SuppressWarnings("unchecked") TypeDeclaration generateClass(Classifier clazz, AST ast,
			CompilationUnit cu); void generateClassJavadoc(Classifier clazz, AST ast,
			AbstractTypeDeclaration td); @SuppressWarnings("unchecked") void generateClassTemplateParams(Classifier clazz, AST ast,
			TypeDeclaration td); void generatePackage(Classifier clazz, AST ast, CompilationUnit cu); void generateMethods(Classifier clazz, AST ast, TypeDeclaration td); @SuppressWarnings("unchecked") void generateMethodTemplateParams(AST ast, Operation operation,
			MethodDeclaration md); void generateMethodJavadoc(AST ast, Operation operation,
			MethodDeclaration md); void generateMethodParams(AST ast, TypeDeclaration td,
			Operation operation, MethodDeclaration md);  }