### Question:
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);  }### Answer:
@Test public void testGetNamespace() throws Exception { Type classType = modelIndex.getType(CLASSTYPE_ID); assertEquals(UMLPACKAGE_NAME, NamespaceHelper.getNamespace(classType, modelIndex)); }
@Test public void testGetNamespaceNonusedType() { Type nonusedType = mock(Type.class); when(nonusedType.getId()).thenReturn(Identifier.random()); assertEquals("", NamespaceHelper.getNamespace(nonusedType, modelIndex)); }