@Test void convertToId() { String[] toBeConverted = { "", "abc", "françois", "aeiouäöü", "üüü", "aB0 -", "My Pokémon Module", "+''--12a?`bcTTT", "\\hello", "+*ç%&/()=", "hello\nworld", "ﯠﯡﯢﯦﯞﯫﯭﻠﻦ", "\u0044DDD", "Hello\tWorld", "Rhøthgar's Modul", "\u0126\u0117\u013C\u013C\u00F8\u005F\u0057\u006F\u0072\u006C\u0064" }; String[] expectedIds = { "", "abc", "franois", "aeiou", "", "ab0--", "my-pokmon-module", "--12abcttt", "hello", "", "helloworld", "", "dddd", "helloworld", "rhthgars-modul", "world" }; for (int i = 0; i < toBeConverted.length; i++) { assertEquals(expectedIds[i], WorkbenchUtils.convertToId(toBeConverted[i])); } }
public static String convertToId(String name) { return CharMatcher.inRange('a', 'z') .or(CharMatcher.inRange('A', 'Z')) .or(CharMatcher.inRange('0', '9')) .or(CharMatcher.is(' ')) .or(CharMatcher.is('-')) .retainFrom(name) .replace(' ', '-') .toLowerCase(); }
WorkbenchUtils { public static String convertToId(String name) { return CharMatcher.inRange('a', 'z') .or(CharMatcher.inRange('A', 'Z')) .or(CharMatcher.inRange('0', '9')) .or(CharMatcher.is(' ')) .or(CharMatcher.is('-')) .retainFrom(name) .replace(' ', '-') .toLowerCase(); } }
WorkbenchUtils { public static String convertToId(String name) { return CharMatcher.inRange('a', 'z') .or(CharMatcher.inRange('A', 'Z')) .or(CharMatcher.inRange('0', '9')) .or(CharMatcher.is(' ')) .or(CharMatcher.is('-')) .retainFrom(name) .replace(' ', '-') .toLowerCase(); } private  WorkbenchUtils(); }
WorkbenchUtils { public static String convertToId(String name) { return CharMatcher.inRange('a', 'z') .or(CharMatcher.inRange('A', 'Z')) .or(CharMatcher.inRange('0', '9')) .or(CharMatcher.is(' ')) .or(CharMatcher.is('-')) .retainFrom(name) .replace(' ', '-') .toLowerCase(); } private  WorkbenchUtils(); static void assertNodeNotSame(Node node1, Node node2); static void addListListener(ObservableList<T> list,
      Consumer<T> addAction,
      Consumer<T> removeAction); static String convertToId(String name); static int calculateColumnsPerRow(int modulesPerPage); }
WorkbenchUtils { public static String convertToId(String name) { return CharMatcher.inRange('a', 'z') .or(CharMatcher.inRange('A', 'Z')) .or(CharMatcher.inRange('0', '9')) .or(CharMatcher.is(' ')) .or(CharMatcher.is('-')) .retainFrom(name) .replace(' ', '-') .toLowerCase(); } private  WorkbenchUtils(); static void assertNodeNotSame(Node node1, Node node2); static void addListListener(ObservableList<T> list,
      Consumer<T> addAction,
      Consumer<T> removeAction); static String convertToId(String name); static int calculateColumnsPerRow(int modulesPerPage);  }