LegacyAllocationConverter { public int addClassName(@NotNull String className) { int id; if (!myAllocatedClasses.containsKey(className)) { id = myAllocatedClasses.size(); myAllocatedClasses.put(className, new ClassName(className, id)); } else { id = myAllocatedClasses.get(className).myClassId; } return id; }  int addClassName(@NotNull String className); @NotNull CallStack addCallStack(@NotNull List<StackTraceElement> stackTraceElements); void resetAllocations(); void addAllocation(@NotNull Allocation allocationInfo); List<AllocationEvent.Allocation> getAllocationEvents(); List<AllocationStack> getAllocationStacks(); List<AllocatedClass> getClassNames(); void parseDump(@NotNull byte[] dumpData);  }
@Test public void testAddClassName() { LegacyAllocationConverter converter = new LegacyAllocationConverter(); int id = converter.addClassName(CLASS_NAME); assertThat(converter.addClassName(CLASS_NAME)).isEqualTo(id); List<AllocatedClass> classes = converter.getClassNames(); assertThat(classes.size()).isEqualTo(1); assertThat(classes.get(0).getClassName()).isEqualTo(CLASS_NAME); assertThat(classes.get(0).getClassId()).isEqualTo(id); }