### Question:
LabelsSource implements Serializable { public synchronized String nextLabel() { if (labels != null) { return labels.get(((Long) counter.getAndIncrement()).intValue()); } else { maxCount = counter.getAndIncrement(); return formatLabel(maxCount); } } LabelsSource();  LabelsSource(@NonNull String template);  LabelsSource(@NonNull List<String> labels); int indexOf(String label); int size(); synchronized String nextLabel(); List<String> getLabels(); void storeLabel(String label); void reset(); int getNumberOfLabelsUsed();  }### Answer:
@Test public void testNextLabel1() throws Exception { LabelsSource generator = new LabelsSource("SENTENCE_"); assertEquals("SENTENCE_0", generator.nextLabel()); }
@Test public void testNextLabel2() throws Exception { LabelsSource generator = new LabelsSource("SENTENCE_%d_HAHA"); assertEquals("SENTENCE_0_HAHA", generator.nextLabel()); }
@Test public void testNextLabel3() throws Exception { List<String> list = Arrays.asList("LABEL0", "LABEL1", "LABEL2"); LabelsSource generator = new LabelsSource(list); assertEquals("LABEL0", generator.nextLabel()); }