@Test public void testNameWithExistingName() { final Import import1 = mock(Import.class); final Import import2 = mock(Import.class); final Import import3 = mock(Import.class); final List<Import> imports = asList(import1, import2, import3); final DMNIncludedModelActiveRecord record = new DMNIncludedModelActiveRecord(null); when(import1.getName()).thenReturn(new Name("foo")); when(import2.getName()).thenReturn(new Name("bar")); when(import3.getName()).thenReturn(new Name("foo bar")); when(modelsIndex.getIndexedImports()).thenReturn(imports); record.setName("foo"); final Name name = factory.name(record); final String expected = "foo - 2"; final String actual = name.getValue(); assertEquals(expected, actual); }
Name name(final BaseIncludedModelActiveRecord record) { return new Name(uniqueName(record.getName())); }
ImportFactory { Name name(final BaseIncludedModelActiveRecord record) { return new Name(uniqueName(record.getName())); } }
ImportFactory { Name name(final BaseIncludedModelActiveRecord record) { return new Name(uniqueName(record.getName())); } @Inject  ImportFactory(final IncludedModelsIndex modelsIndex); }
ImportFactory { Name name(final BaseIncludedModelActiveRecord record) { return new Name(uniqueName(record.getName())); } @Inject  ImportFactory(final IncludedModelsIndex modelsIndex); Import makeImport(final BaseIncludedModelActiveRecord record); }
ImportFactory { Name name(final BaseIncludedModelActiveRecord record) { return new Name(uniqueName(record.getName())); } @Inject  ImportFactory(final IncludedModelsIndex modelsIndex); Import makeImport(final BaseIncludedModelActiveRecord record);  }