ValidCharacters { public static String toValidCharset(String str) { return toValidCharsetTable(CHARS_ALLOWED, str); } private  ValidCharacters(); static boolean hasInvalidCharacters(String str); static String toValidCharset(String str); static Metric toValidValue(Metric metric); static List<Metric> toValidValues(List<Metric> metrics); static void tagToJson(JsonGenerator gen, Tag tag);  }
@Test public void testValidStrIsUnchanged() throws Exception { String valid = "abc09.-_"; assertEquals(ValidCharacters.toValidCharset(valid), valid); }
@Test public void testInvalidStrIsFixed() throws Exception { String str = "Aabc09.-~^_ abc"; assertEquals(ValidCharacters.toValidCharset(str), "Aabc09.-____abc"); String boundaries = "\u0000\u0128\uffff"; assertEquals(ValidCharacters.toValidCharset(boundaries), "___"); }