### Question:
UniqueStringGenerator { public String getUniqueString(S selector) { requireNonNull(selector, "selector"); NamePattern namePattern = namePatterns.get(selector); checkArgument(namePattern != null, "Unknown selector: %s", selector); return getUniqueString(namePattern.prefix, namePattern.suffixPattern); } UniqueStringGenerator(); void registerNamePattern(S selector,
                                  String prefix,
                                  String suffixPattern); void addString(final String newString); void removeString(final String rmString); void clear(); String getUniqueString(S selector); String getUniqueString(final String prefix,
                                final String suffixPattern);  }### Answer:
@Test public void testRepeatedGenerationWithoutModification() { String generatedString = generator.getUniqueString(PREFIX, PATTERN_TWO_DIGITS); assertEquals(PREFIX + "01", generatedString); generatedString = generator.getUniqueString(PREFIX, PATTERN_TWO_DIGITS); assertEquals(PREFIX + "01", generatedString); }
@Test public void testNullPrefix() { String generatedString = generator.getUniqueString(null, PATTERN_ONE_DIGIT); assertEquals("1", generatedString); }