@Test public void testGetNamespaceNonusedType() { Type nonusedType = mock(Type.class); when(nonusedType.getId()).thenReturn(Identifier.random()); assertEquals("", NamespaceHelper.getNamespace(nonusedType, modelIndex)); }
public static final String getNamespace(final Type type, final ModelIndex model) { for (final ModelElement whereUsed : model.whereUsed(type.getId())) { if (whereUsed instanceof UmlPackage) { final UmlPackage pkg = (UmlPackage) whereUsed; return pkg.getName(); } } return ""; }
NamespaceHelper { public static final String getNamespace(final Type type, final ModelIndex model) { for (final ModelElement whereUsed : model.whereUsed(type.getId())) { if (whereUsed instanceof UmlPackage) { final UmlPackage pkg = (UmlPackage) whereUsed; return pkg.getName(); } } return ""; } }
NamespaceHelper { public static final String getNamespace(final Type type, final ModelIndex model) { for (final ModelElement whereUsed : model.whereUsed(type.getId())) { if (whereUsed instanceof UmlPackage) { final UmlPackage pkg = (UmlPackage) whereUsed; return pkg.getName(); } } return ""; }  }
NamespaceHelper { public static final String getNamespace(final Type type, final ModelIndex model) { for (final ModelElement whereUsed : model.whereUsed(type.getId())) { if (whereUsed instanceof UmlPackage) { final UmlPackage pkg = (UmlPackage) whereUsed; return pkg.getName(); } } return ""; }  static final String getNamespace(final Type type, final ModelIndex model); }
NamespaceHelper { public static final String getNamespace(final Type type, final ModelIndex model) { for (final ModelElement whereUsed : model.whereUsed(type.getId())) { if (whereUsed instanceof UmlPackage) { final UmlPackage pkg = (UmlPackage) whereUsed; return pkg.getName(); } } return ""; }  static final String getNamespace(final Type type, final ModelIndex model);  }