GraphExportStyles { @SuppressWarnings("squid:S4248") public static String getId(String classname) { return "_" + classname.replaceAll("<", "_") .replaceAll(">", "_") .replaceAll("\\s+", "_") .replaceAll("\\.", "_") .replaceAll("\\$", "_") .replaceAll(":", "_") .replaceAll("/", "_") .replaceAll("#", "_") .replaceAll("\\(", "_") .replaceAll("\\)", "_") .replaceAll("-", "_"); } private  GraphExportStyles(); static EdgeStyle getEdgeStyle(Dependency rel); @SuppressWarnings("squid:S4248") // wants to move the RegExes into constants; would not help readability here. static String getId(String classname); @SuppressWarnings("squid:S4248") // wants to move the RegExes into constants; would not help readability here. static String getLabel(List<Abbreviation> abbreviations, String name);  }
@Test public void testGetId() { assertThat(GraphExportStyles.getId("com.my.a.B"), is("_com_my_a_B")); assertThat(GraphExportStyles.getId("com.my.a.B$Inner"), is("_com_my_a_B_Inner")); assertThat(GraphExportStyles.getId("<com.my.a.B$Inner>"), is("__com_my_a_B_Inner_")); assertThat(GraphExportStyles.getId("com.my.a.B Inner"), is("_com_my_a_B_Inner")); assertThat(GraphExportStyles.getId("com.my:module"), is("_com_my_module")); assertThat(GraphExportStyles.getId("com.my:my-module"), is("_com_my_my_module")); assertThat(GraphExportStyles.getId("com/my/my-module"), is("_com_my_my_module")); assertThat(GraphExportStyles.getId("a#<init>"), is("_a__init_")); assertThat(GraphExportStyles.getId("a(b)"), is("_a_b_")); }