LegacyAllocationConverter { public void addAllocation(@NotNull Allocation allocationInfo) { myAllocations.add(allocationInfo); }  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 testAddAllocation() { LegacyAllocationConverter converter = new LegacyAllocationConverter(); int id = converter.addClassName(CLASS_NAME); converter.addAllocation(new LegacyAllocationConverter.Allocation(id, SIZE, THREAD_ID, STACK_ID)); List<AllocationEvent.Allocation> allocations = converter.getAllocationEvents(); assertThat(allocations.size()).isEqualTo(1); assertThat(allocations.get(0).getClassTag()).isEqualTo(id); assertThat(allocations.get(0).getSize()).isEqualTo(SIZE); assertThat(allocations.get(0).getThreadId()).isEqualTo(THREAD_ID); assertThat(allocations.get(0).getStackId()).isEqualTo(STACK_ID); converter.resetAllocations(); assertThat(converter.getAllocationEvents().size()).isEqualTo(0); }