TracerParameters { static String hideString(String input) { if (input == null || input.isEmpty()) { return input; } if (input.length() <= 2) { return Strings.repeat("X", input.length()); } return new StringBuilder(input).replace(1, input.length() - 1, Strings.repeat("X", input.length() - 2)) .toString(); } private  TracerParameters(); static Options.OptionsBuilder getOptionsFromParameters(Options.OptionsBuilder optionsBuilder); @SuppressWarnings({"unchecked", "rawtypes"}) static Map<String, String> getParameters(); final static String ACCESS_TOKEN; final static String CLOCK_SKEW_CORRECTION; final static String COMPONENT_NAME; final static String COLLECTOR_CLIENT; final static String COLLECTOR_HOST; final static String COLLECTOR_PORT; final static String COLLECTOR_PROTOCOL; final static String DEADLINE_MILLIS; final static String DISABLE_REPORTING_LOOP; final static String MAX_BUFFERED_SPANS; final static String MAX_REPORTING_INTERVAL_MILLIS; final static String RESET_CLIENT; final static String VERBOSITY; final static String TAGS; final static String PROPAGATOR; final static String SERVICE_VERSION; final static String DISABLE_METRICS_REPORTING; final static String METRICS_URL; final static String HOSTNAME; final static String [] ALL; }
@Test public void testHideString() { assertNull(TracerParameters.hideString(null)); assertEquals("", TracerParameters.hideString("")); assertEquals("X", TracerParameters.hideString("a")); assertEquals("XX", TracerParameters.hideString("ab")); assertEquals("aXc", TracerParameters.hideString("abc")); assertEquals("aXXd", TracerParameters.hideString("abcd")); assertEquals("aXXXe", TracerParameters.hideString("abcde")); assertEquals("1XXXXXXX9", TracerParameters.hideString("123456789")); }