@SuppressWarnings("unchecked") @Test public void testCheckParameterizedTypeForTemplateParameterSubstitutionWithNoSubstitution() { prepareMocks(); Iterator<Element> iteratorElement = mock(Iterator.class); when(iteratorElement.hasNext()).thenReturn(false); when(type.getName()).thenReturn("Data::datatype::Collection<Person>"); when(type.getQualifiedName()).thenReturn( "Data::datatype::Collection<de::test::Person>"); Map<String, String> results = umlHelper .checkParameterizedTypeForTemplateParameterSubstitution(type); String umlTypeName = results.get("umlTypeName"); String umlQualifiedTypeName = results.get("umlQualifiedTypeName"); assertEquals("Data::datatype::Collection<Person>", umlTypeName); assertEquals("Data::datatype::Collection<de::test::Person>", umlQualifiedTypeName); }
public Map<String, String> checkParameterizedTypeForTemplateParameterSubstitution( Type type) { Map<String, String> results = new HashMap<String, String>(); String umlTypeName = type.getName(); String umlQualifiedTypeName = type.getQualifiedName(); List<String> templateSubstitutions = getTemplateParameterSubstitution(type); if (templateSubstitutions.size() != 0) { int index = 0; String paramTypeNames = StringUtils .substringAfter(umlTypeName, "<"); paramTypeNames = StringUtils.removeEnd(paramTypeNames, ">"); EList<String> paramTypeNameList = convertStringToList( paramTypeNames, ","); for (String paramTypeName : paramTypeNameList) { umlTypeName = StringUtils.replace(umlTypeName, paramTypeName, templateSubstitutions.get(index)); umlQualifiedTypeName = StringUtils.replace( umlQualifiedTypeName, paramTypeName, templateSubstitutions.get(index)); index = index + 1; } } results.put("umlTypeName", umlTypeName); results.put("umlQualifiedTypeName", umlQualifiedTypeName); return results; }
UmlHelper { public Map<String, String> checkParameterizedTypeForTemplateParameterSubstitution( Type type) { Map<String, String> results = new HashMap<String, String>(); String umlTypeName = type.getName(); String umlQualifiedTypeName = type.getQualifiedName(); List<String> templateSubstitutions = getTemplateParameterSubstitution(type); if (templateSubstitutions.size() != 0) { int index = 0; String paramTypeNames = StringUtils .substringAfter(umlTypeName, "<"); paramTypeNames = StringUtils.removeEnd(paramTypeNames, ">"); EList<String> paramTypeNameList = convertStringToList( paramTypeNames, ","); for (String paramTypeName : paramTypeNameList) { umlTypeName = StringUtils.replace(umlTypeName, paramTypeName, templateSubstitutions.get(index)); umlQualifiedTypeName = StringUtils.replace( umlQualifiedTypeName, paramTypeName, templateSubstitutions.get(index)); index = index + 1; } } results.put("umlTypeName", umlTypeName); results.put("umlQualifiedTypeName", umlQualifiedTypeName); return results; } }
UmlHelper { public Map<String, String> checkParameterizedTypeForTemplateParameterSubstitution( Type type) { Map<String, String> results = new HashMap<String, String>(); String umlTypeName = type.getName(); String umlQualifiedTypeName = type.getQualifiedName(); List<String> templateSubstitutions = getTemplateParameterSubstitution(type); if (templateSubstitutions.size() != 0) { int index = 0; String paramTypeNames = StringUtils .substringAfter(umlTypeName, "<"); paramTypeNames = StringUtils.removeEnd(paramTypeNames, ">"); EList<String> paramTypeNameList = convertStringToList( paramTypeNames, ","); for (String paramTypeName : paramTypeNameList) { umlTypeName = StringUtils.replace(umlTypeName, paramTypeName, templateSubstitutions.get(index)); umlQualifiedTypeName = StringUtils.replace( umlQualifiedTypeName, paramTypeName, templateSubstitutions.get(index)); index = index + 1; } } results.put("umlTypeName", umlTypeName); results.put("umlQualifiedTypeName", umlQualifiedTypeName); return results; }  }
UmlHelper { public Map<String, String> checkParameterizedTypeForTemplateParameterSubstitution( Type type) { Map<String, String> results = new HashMap<String, String>(); String umlTypeName = type.getName(); String umlQualifiedTypeName = type.getQualifiedName(); List<String> templateSubstitutions = getTemplateParameterSubstitution(type); if (templateSubstitutions.size() != 0) { int index = 0; String paramTypeNames = StringUtils .substringAfter(umlTypeName, "<"); paramTypeNames = StringUtils.removeEnd(paramTypeNames, ">"); EList<String> paramTypeNameList = convertStringToList( paramTypeNames, ","); for (String paramTypeName : paramTypeNameList) { umlTypeName = StringUtils.replace(umlTypeName, paramTypeName, templateSubstitutions.get(index)); umlQualifiedTypeName = StringUtils.replace( umlQualifiedTypeName, paramTypeName, templateSubstitutions.get(index)); index = index + 1; } } results.put("umlTypeName", umlTypeName); results.put("umlQualifiedTypeName", umlQualifiedTypeName); return results; }  void log(Object o); void log(Object o, String logMsg); String getFQNPackageName(Type type); String getFQNPackagePath(Type type); String getFQNComponentName(Type type); String getFQNComponentPath(Type type); String getXmiId(EObject eObject); EList<Property> getAllAttributes(Classifier classifier); EList<Operation> getAllOperations(Classifier classifier); @SuppressWarnings("unchecked") EList<Dependency> getAllDependencies(NamedElement element); @SuppressWarnings("unchecked") EList<Association> getAllAssociations(Classifier classifier); @SuppressWarnings({ "rawtypes", "unchecked" }) String formatComment(Element element, String prefix,
			String propertyFileName); boolean createAnnotationSourceKey(String propertyFileName); @SuppressWarnings({ "rawtypes", "unchecked" }) String formatParameterComment(Parameter parameter, String prefix,
			String annotation, String propertyFileName); String getDefaultValue(Property property); EList<String> convertStringToList(String theString, String delimiter); List<String> getTemplateParameterSubstitution(Type type); Map<String, String> checkParameterizedTypeForTemplateParameterSubstitution(
			Type type); }
UmlHelper { public Map<String, String> checkParameterizedTypeForTemplateParameterSubstitution( Type type) { Map<String, String> results = new HashMap<String, String>(); String umlTypeName = type.getName(); String umlQualifiedTypeName = type.getQualifiedName(); List<String> templateSubstitutions = getTemplateParameterSubstitution(type); if (templateSubstitutions.size() != 0) { int index = 0; String paramTypeNames = StringUtils .substringAfter(umlTypeName, "<"); paramTypeNames = StringUtils.removeEnd(paramTypeNames, ">"); EList<String> paramTypeNameList = convertStringToList( paramTypeNames, ","); for (String paramTypeName : paramTypeNameList) { umlTypeName = StringUtils.replace(umlTypeName, paramTypeName, templateSubstitutions.get(index)); umlQualifiedTypeName = StringUtils.replace( umlQualifiedTypeName, paramTypeName, templateSubstitutions.get(index)); index = index + 1; } } results.put("umlTypeName", umlTypeName); results.put("umlQualifiedTypeName", umlQualifiedTypeName); return results; }  void log(Object o); void log(Object o, String logMsg); String getFQNPackageName(Type type); String getFQNPackagePath(Type type); String getFQNComponentName(Type type); String getFQNComponentPath(Type type); String getXmiId(EObject eObject); EList<Property> getAllAttributes(Classifier classifier); EList<Operation> getAllOperations(Classifier classifier); @SuppressWarnings("unchecked") EList<Dependency> getAllDependencies(NamedElement element); @SuppressWarnings("unchecked") EList<Association> getAllAssociations(Classifier classifier); @SuppressWarnings({ "rawtypes", "unchecked" }) String formatComment(Element element, String prefix,
			String propertyFileName); boolean createAnnotationSourceKey(String propertyFileName); @SuppressWarnings({ "rawtypes", "unchecked" }) String formatParameterComment(Parameter parameter, String prefix,
			String annotation, String propertyFileName); String getDefaultValue(Property property); EList<String> convertStringToList(String theString, String delimiter); List<String> getTemplateParameterSubstitution(Type type); Map<String, String> checkParameterizedTypeForTemplateParameterSubstitution(
			Type type);  }