AttributesUtil { public static String toProtobufFormat(String value) { return INVALID_CHAR.matcher(value).replaceAll("__") .replaceAll("-", "_"); }  static String toProtobufFormat(String value); static String toKPropertyFormat(String value);  }
@Test public void toProtobufFormat_replaceInvalidCharactersWithTwoUnderscores() { assertThat(AttributesUtil.toProtobufFormat("abcdEFGH")).isEqualTo("abcdEFGH"); assertThat(AttributesUtil.toProtobufFormat("a.b")).isEqualTo("a__b"); assertThat(AttributesUtil.toProtobufFormat("c/d")).isEqualTo("c__d"); assertThat(AttributesUtil.toProtobufFormat("e:f")).isEqualTo("e__f"); assertThat(AttributesUtil.toProtobufFormat("g[h]")).isEqualTo("g__h__"); assertThat(AttributesUtil.toProtobufFormat("i-j")).isEqualTo("i_j"); assertThat(AttributesUtil.toProtobufFormat("./:[]-")).isEqualTo("___________"); }