RegexTool { public Pattern compile(String regex) { try { return Pattern.compile(regex); } catch (PatternSyntaxException ex) { return null; } }  List<RegexResult> find(String content, String regex); List<List<RegexResult>> findAll(String content, String regex); Pattern compile(String regex); String quote(String s); String quoteReplacement(String s);  }
@Test void compileInvalidRegex() { RegexTool tool = new RegexTool(); Pattern p = tool.compile("*"); assertNull(p); }