@Test public void highlightFlags() { final List<Option> options = new ArrayList<>(); options.add(new Option("--assignee, -a=<String[]>", null)); options.add(new Option("--body, -b=<String>", null)); options.add(new Option("--body-formatter, -g=<String>", null)); options.add(new Option("--assign", null)); options.add(new Option("--file, -f=<File>", null)); options.add(new Option("--a", null)); final Highlight highlight = new Highlight(options); assertEquals("\u001B[0m\u001B[1m--assignee\u001B[0m", highlight.matches("--assignee")); assertEquals("the flags --ab and --body-wash are not valid", highlight.matches("the flags --ab and --body-wash are not valid")); assertEquals("the flags " + "\u001B[0m\u001B[1m-a\u001B[0m and " + "\u001B[0m\u001B[1m-b\u001B[0m are " + "valid but -file and --body-double are not", highlight.matches("the flags -a and -b are valid but -file and --body-double are not")); assertEquals("foo \u001B[0m\u001B[1m--assignee\u001B[0m" + " bar baz \u001B[0m\u001B[1m--a\u001B[0m" + " and \u001B[0m\u001B[1m--file\u001B[0m" + " with a \u001B[0m\u001B[1m--body\u001B[0m" + " and \u001B[0m\u001B[1m--body-formatter\u001B[0m" + " and --body-nothing and \u001B[0m\u001B[1m--a\u001B[0m", highlight.matches("foo --assignee bar baz --a and " + "--file with a --body and --body-formatter and --body-nothing and --a")); }
public String matches(String text) { text = matches(text, flags); text = matches(text, code); return text; }
Highlight { public String matches(String text) { text = matches(text, flags); text = matches(text, code); return text; } }
Highlight { public String matches(String text) { text = matches(text, flags); text = matches(text, code); return text; } Highlight(final List<Option> options); }
Highlight { public String matches(String text) { text = matches(text, flags); text = matches(text, code); return text; } Highlight(final List<Option> options); String highlight(String text); String matches(String text); }
Highlight { public String matches(String text) { text = matches(text, flags); text = matches(text, code); return text; } Highlight(final List<Option> options); String highlight(String text); String matches(String text);  }