SQLStatisticsEventValidator { public static String cleanString(final String dirtyString) { if (dirtyString != null) { final String cleanedString = dirtyString.replaceAll(SQLStatisticConstants.NAME_SEPARATOR, SQLStatisticConstants.DIRTY_CHARACTER_REPLACEMENT); return cleanedString; } else { return dirtyString; } }  static List<String> validateEvent(final StatisticEvent statisticEvent); static String cleanString(final String dirtyString); static boolean isKeyTooLong(final String statisticKey);  }
@Test void testCleanString_dirty() { final String dirtyString = "abc" + SQLStatisticConstants.NAME_SEPARATOR + "def"; final String cleanString = validator.cleanString(dirtyString); assertThat(cleanString).isEqualTo("abc#def"); }
@Test void testCleanString_clean() { final String stringToClean = "0123456789aAzZ .()-_$\\/[]{}_!\"'£$%^&*+-=~@"; final String cleanString = validator.cleanString(stringToClean); assertThat(cleanString).isEqualTo(stringToClean); }