fqn = fqn.indexOf("$") == -1 ? fqn : fqn.substring(0, fqn.indexOf("$"));
String classFile = fqn + ".java";
File file = new File("src" + separator + classFile);
Scanner scanner = null;
List<String> comments = newArrayList();
MultiLineTextBuilder comment = new MultiLineTextBuilder();
try {
scanner = new Scanner(new FileInputStream(file));
String line;
while (scanner.hasNextLine()) {
line = scanner.nextLine().replaceFirst("^\\s*", "");
if (line.startsWith(COMMENT_START)) {
String text = line.substring(COMMENT_START.length());
if (text.startsWith(" ")) {
text = text.substring(1);
}
comment.append(text);
continue;
}
if (comment.isEmpty()) {
continue;
}
line = line.trim();
String testName = testName(line);
if (line.length() == 0 || testName != null) {
if (!comments.contains(comment)) {
comments.add(comment.toString());
}
comment = new MultiLineTextBuilder();
}
if (testName != null) {
commentsByMethod.put(testName, comments);
comments = newArrayList();
}