void (String fileText, Collection<String> knownPrefixes) { Set<String> prefixes = new HashSet<>(); for (String line : fileNonEmptyCommentedLines(fileText)) { String prefix = probableDirective(line); if (prefix != null) { prefixes.add(prefix); } } prefixes.removeAll(cleanDirectivesFromComments(knownPrefixes)); Assert.assertTrue("File contains some unexpected directives" + prefixes, prefixes.isEmpty()); }