### Question:
LabelGenerator { public Label generate(String name) { var counter = counters.get(name); if (counter == null) { counters.put(name, counter = new AtomicInteger()); } return new Label(shared.getAndIncrement(), name + "_" + counter.getAndIncrement()); }  Label generate(String name); void reset();  }### Answer:
@Test void testGenerate() { var generator = new LabelGenerator(); assertEquals(0, generator.generate("test").getId()); assertEquals(1, generator.generate("test").getId()); assertEquals(2, generator.generate("dummy").getId()); assertEquals("test_2", generator.generate("test").getName()); }