### Question:
GlobUtil { private static int alternation(String glob, int i, int length, StringBuilder result) { result.append("(?:"); while (i < length) { char current = glob.charAt(i++); switch (current) { case '}': result.append(')'); return i; case ',': result.append('|'); i = glob(glob, i, length, ",}", result); break; default: i--; i = glob(glob, i, length, ",}", result); break; } } throw new IllegalStateException(String.format("Missing } at the end of input in glob %s", glob)); } private  GlobUtil(); static String toRegexPattern(String glob);  }### Answer:
@Test void alternation() { assertMatch("file.{txt,adoc}", Arrays.asList("file.txt", "file.adoc"), Arrays.asList("file.java", "file.txtx", "file./txt")); }