@Test void testAddEntityType() { EntityType entityType = mock(EntityType.class); when(entityType.setLabel(any())).thenReturn(entityType); when(entityType.setPackage(any())).thenReturn(entityType); when(entityTypeFactory.create("entityType")).thenReturn(entityType); assertEquals(entityType, intermediateParseResults.addEntityType("entityType")); verify(entityType).setLabel("entityType"); }
public EntityType addEntityType(String fullyQualifiedName) { String entityTypeLabel = fullyQualifiedName; Package pack = null; for (Package p : packages.values()) { String packageName = p.getId(); if (fullyQualifiedName.toLowerCase().startsWith(packageName.toLowerCase())) { entityTypeLabel = fullyQualifiedName.substring(packageName.length() + 1); pack = p; } } EntityType entityType = entityTypeFactory.create(fullyQualifiedName).setLabel(entityTypeLabel).setPackage(pack); entityTypes.put(fullyQualifiedName, entityType); return entityType; }
IntermediateParseResults { public EntityType addEntityType(String fullyQualifiedName) { String entityTypeLabel = fullyQualifiedName; Package pack = null; for (Package p : packages.values()) { String packageName = p.getId(); if (fullyQualifiedName.toLowerCase().startsWith(packageName.toLowerCase())) { entityTypeLabel = fullyQualifiedName.substring(packageName.length() + 1); pack = p; } } EntityType entityType = entityTypeFactory.create(fullyQualifiedName).setLabel(entityTypeLabel).setPackage(pack); entityTypes.put(fullyQualifiedName, entityType); return entityType; } }
IntermediateParseResults { public EntityType addEntityType(String fullyQualifiedName) { String entityTypeLabel = fullyQualifiedName; Package pack = null; for (Package p : packages.values()) { String packageName = p.getId(); if (fullyQualifiedName.toLowerCase().startsWith(packageName.toLowerCase())) { entityTypeLabel = fullyQualifiedName.substring(packageName.length() + 1); pack = p; } } EntityType entityType = entityTypeFactory.create(fullyQualifiedName).setLabel(entityTypeLabel).setPackage(pack); entityTypes.put(fullyQualifiedName, entityType); return entityType; } IntermediateParseResults(EntityTypeFactory entityTypeFactory); }
IntermediateParseResults { public EntityType addEntityType(String fullyQualifiedName) { String entityTypeLabel = fullyQualifiedName; Package pack = null; for (Package p : packages.values()) { String packageName = p.getId(); if (fullyQualifiedName.toLowerCase().startsWith(packageName.toLowerCase())) { entityTypeLabel = fullyQualifiedName.substring(packageName.length() + 1); pack = p; } } EntityType entityType = entityTypeFactory.create(fullyQualifiedName).setLabel(entityTypeLabel).setPackage(pack); entityTypes.put(fullyQualifiedName, entityType); return entityType; } IntermediateParseResults(EntityTypeFactory entityTypeFactory); void addTag(String identifier, Tag tag); boolean hasTag(String identifier); Tag getTag(String tagIdentifier); Package getPackage(String name); void addAttributes(String entityTypeId, List<EmxAttribute> emxAttrs); static void setDefaultLookupAttributes(EntityType entityType, int lookupAttributeIndex); EntityType addEntityType(String fullyQualifiedName); EntityType getEntityType(String name); void addLanguage(Language language); void addL10nString(L10nString l10nString); boolean hasEntityType(String name); boolean hasPackage(String name); void addPackage(String name, Package p); ImmutableMap<String, EntityType> getEntityMap(); ImmutableList<EntityType> getEntityTypes(); ImmutableMap<String, Package> getPackages(); ImmutableMap<String, Tag> getTags(); ImmutableMap<String, Language> getLanguages(); ImmutableMap<String, L10nString> getL10nStrings(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
IntermediateParseResults { public EntityType addEntityType(String fullyQualifiedName) { String entityTypeLabel = fullyQualifiedName; Package pack = null; for (Package p : packages.values()) { String packageName = p.getId(); if (fullyQualifiedName.toLowerCase().startsWith(packageName.toLowerCase())) { entityTypeLabel = fullyQualifiedName.substring(packageName.length() + 1); pack = p; } } EntityType entityType = entityTypeFactory.create(fullyQualifiedName).setLabel(entityTypeLabel).setPackage(pack); entityTypes.put(fullyQualifiedName, entityType); return entityType; } IntermediateParseResults(EntityTypeFactory entityTypeFactory); void addTag(String identifier, Tag tag); boolean hasTag(String identifier); Tag getTag(String tagIdentifier); Package getPackage(String name); void addAttributes(String entityTypeId, List<EmxAttribute> emxAttrs); static void setDefaultLookupAttributes(EntityType entityType, int lookupAttributeIndex); EntityType addEntityType(String fullyQualifiedName); EntityType getEntityType(String name); void addLanguage(Language language); void addL10nString(L10nString l10nString); boolean hasEntityType(String name); boolean hasPackage(String name); void addPackage(String name, Package p); ImmutableMap<String, EntityType> getEntityMap(); ImmutableList<EntityType> getEntityTypes(); ImmutableMap<String, Package> getPackages(); ImmutableMap<String, Tag> getTags(); ImmutableMap<String, Language> getLanguages(); ImmutableMap<String, L10nString> getL10nStrings(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }