private void assertBad(String s, String expectedErrorSubstring) throws IOException {
   assertEquals(1, rule.match(langTool.getAnalyzedSentence(s)).length);
   final String errorMessage = rule.match(langTool.getAnalyzedSentence(s))[0].getMessage();
   assertTrue(
       "Got error '" + errorMessage + "', expected substring '" + expectedErrorSubstring + "'",
       errorMessage.contains(expectedErrorSubstring));
 }
 private void assertBad(String s, int n, String... expectedSuggestions) throws IOException {
   RuleMatch[] matches = rule.match(langTool.getAnalyzedSentence(s));
   assertEquals("Did not find " + n + " match(es) in sentence '" + s + "'", n, matches.length);
   if (expectedSuggestions.length > 0) {
     RuleMatch match = matches[0];
     // When two errors are reported by the rule (so TODO above), it might happen that the first
     // match does not have the suggestions, but the second one
     if (matches.length > 1 && match.getSuggestedReplacements().size() == 0) {
       match = matches[1];
     }
     List<String> suggestions = match.getSuggestedReplacements();
     assertThat(suggestions, is(Arrays.asList(expectedSuggestions)));
   }
 }
 private void assertBad(String s, int n) throws IOException {
   assertEquals(n, rule.match(langTool.getAnalyzedSentence(s)).length);
 }