### Question:
DataTypeList { String buildName(final String nameCandidate, final Map<String, Integer> namesCount) { if (namesCount.containsKey(nameCandidate)) { final Integer occurrences = namesCount.get(nameCandidate); namesCount.replace(nameCandidate, occurrences + 1); return nameCandidate + NAME_SEPARATOR + occurrences; } namesCount.put(nameCandidate, 1); return nameCandidate; } @Inject  DataTypeList(final View view,
                        final ManagedInstance<DataTypeListItem> listItems,
                        final DataTypeManager dataTypeManager,
                        final DataTypeSearchBar searchBar,
                        final DNDListComponent dndListComponent,
                        final DataTypeStackHash dataTypeStackHash,
                        final DNDDataTypesHandler dndDataTypesHandler,
                        final DataTypeListHighlightHelper highlightHelper,
                        final IsKogito isKogito); HTMLElement getElement(); void setupItems(final List<DataType> dataTypes); Optional<DataTypeListItem> findItem(final DataType dataType); DNDListComponent getDNDListComponent(); List<DataTypeListItem> getItems(); void showNoDataTypesFound(); void showListItems(); void collapseAll(); void enableEditMode(final String dataTypeHash); void registerDataTypeListItemUpdateCallback(final Consumer<DataTypeListItem> onDataTypeListItemUpdate); Optional<DataTypeListItem> findItemByDataTypeHash(final String dataTypeHash); String calculateHash(final DataType dataType); void onDataTypeEditModeToggle(final @Observes DataTypeEditModeToggleEvent event); HTMLElement getListItems(); void importDataObjects(final List<DataObject> selectedDataObjects); void disableEditModeForChildren(final DataTypeListItem dataTypeListItem); List<String> getExistingDataTypesNames(); void highlightLevel(final DataType dataType); void highlightLevel(final Element element); void highlight(final Element element); void cleanLevelHighlightClass(); void cleanHighlightClass();  }### Answer:
@Test public void testBuildName() { final String name = "MyClass"; final String differentName = "SomeOtherClass"; final HashMap<String, Integer> namesCount = new HashMap<>(); final String occurrence0 = dataTypeList.buildName(name, namesCount); assertEquals(name, occurrence0); final String occurrence1 = dataTypeList.buildName(name, namesCount); assertEquals(name + DataTypeList.NAME_SEPARATOR + "1", occurrence1); final String occurrence2 = dataTypeList.buildName(name, namesCount); assertEquals(name + DataTypeList.NAME_SEPARATOR + "2", occurrence2); final String differentOccurrence0 = dataTypeList.buildName(differentName, namesCount); assertEquals(differentName, differentOccurrence0); final String differentOccurrence1 = dataTypeList.buildName(differentName, namesCount); assertEquals(differentName + DataTypeList.NAME_SEPARATOR + "1", differentOccurrence1); }