PackageHelper { public String getFullPackageName(Classifier clazz, String sourceDirectoryPackageName) { logger.log(Level.FINE, "Qualified name: " + clazz.getQualifiedName()); String toBeDeleted = sourceDirectoryPackageName + "::"; String fullPackageName = clazz.getQualifiedName().replaceFirst( toBeDeleted, ""); toBeDeleted = "::" + clazz.getName(); fullPackageName = fullPackageName.replaceFirst(toBeDeleted, ""); fullPackageName = fullPackageName.replaceAll("::", "."); logger.log(Level.FINE, "Real package name: " + fullPackageName); return fullPackageName; }  org.eclipse.uml2.uml.Package getRootPackage(Context context); String getFullPackageName(Classifier clazz,
			String sourceDirectoryPackageName); String getFullPackageName(String umlPackageNameWithClass,
			String sourceDirectoryPackageName); String removeUmlPrefixes(final String fullQualifiedName);  }
@Test public void testGetFullPackageNameWithClass() { Class clazz = mock(Class.class); when(clazz.getQualifiedName()).thenReturn( "Data::de::crowdcode::test::Company"); String sourceDirectoryPackageName = "Data"; String result = packageHelper.getFullPackageName(clazz, sourceDirectoryPackageName); verify(clazz, atLeastOnce()).getQualifiedName(); assertEquals("de.crowdcode.test.Company", result); }
@Test public void testGetFullPackageNameWithString() { String sourceDirectoryPackageName = "Data"; String umlPackageNameWithClass = "Data::de.crowdcode.test.Company"; String result = packageHelper.getFullPackageName( umlPackageNameWithClass, sourceDirectoryPackageName); assertEquals("de.crowdcode.test.Company", result); }
@Test public void testGetFullPackageNameWithStringNonData() { String sourceDirectoryPackageName = "MyModel"; String umlPackageNameWithClass = "MyModel::de.crowdcode.test.Company"; String result = packageHelper.getFullPackageName( umlPackageNameWithClass, sourceDirectoryPackageName); assertEquals("de.crowdcode.test.Company", result); }
@Test public void testGetFullPackageNameWithStringWithDataAndUmlPrefixes() { String sourceDirectoryPackageName = "Data"; String umlPackageNameWithClass = "Data::datatype::String"; String result = packageHelper.getFullPackageName( umlPackageNameWithClass, sourceDirectoryPackageName); assertEquals("String", result); }
@Test public void testGetFullPackageNameWithCompanyWithDataAndUmlPrefixes() { String sourceDirectoryPackageName = "Data"; String umlPackageNameWithClass = "Data::datatype::de::test::Company"; String result = packageHelper.getFullPackageName( umlPackageNameWithClass, sourceDirectoryPackageName); assertEquals("de.test.Company", result); }
@Test public void testGetFullPackageNameWithStringAlreadyOk() { String sourceDirectoryPackageName = "Data"; String umlPackageNameWithClass = "de.crowdcode.test.Company"; String result = packageHelper.getFullPackageName( umlPackageNameWithClass, sourceDirectoryPackageName); assertEquals("de.crowdcode.test.Company", result); }
@Test public void testGetFullPackageNameWithStringAlreadyOkWithoutSourceDirectoryPackageName() { String sourceDirectoryPackageName = ""; String umlPackageNameWithClass = "de.crowdcode.test.Company"; String result = packageHelper.getFullPackageName( umlPackageNameWithClass, sourceDirectoryPackageName); assertEquals("de.crowdcode.test.Company", result); }
@Test public void testGetFullPackageNameWithGenerics() { String sourceDirectoryPackageName = "Data"; String umlPackageNameWithClass = "T"; String result = packageHelper.getFullPackageName( umlPackageNameWithClass, sourceDirectoryPackageName); assertEquals("T", result); }
@Test public void testGetFullPackageNameWithGenericsDataBindings1() { String sourceDirectoryPackageName = "Data"; String umlPackageNameWithClass = "Data::Collection<de.test.Company>"; String result = packageHelper.getFullPackageName( umlPackageNameWithClass, sourceDirectoryPackageName); assertEquals("Collection<de.test.Company>", result); }
@Test public void testGetFullPackageNameWithGenericsDataBindings2() { String sourceDirectoryPackageName = "Data"; String umlPackageNameWithClass = "Data::datatype::Collection<de::test::Company>"; String result = packageHelper.getFullPackageName( umlPackageNameWithClass, sourceDirectoryPackageName); assertEquals("Collection<de.test.Company>", result); }
@Test public void testGetFullPackageNameWithGenericsDataBindings3() { String sourceDirectoryPackageName = "Data"; String umlPackageNameWithClass = "Data::datatype::Collection<Data::de::test::Company>"; String result = packageHelper.getFullPackageName( umlPackageNameWithClass, sourceDirectoryPackageName); assertEquals("Collection<de.test.Company>", result); }