diff options
author | wisberg <wisberg> | 2002-12-16 18:51:06 +0000 |
---|---|---|
committer | wisberg <wisberg> | 2002-12-16 18:51:06 +0000 |
commit | 144143c2970a1e874d74cdbd0f8c622d4282a3c3 (patch) | |
tree | b12383d3d9e76c7e1f25f7fbec83051ef17f81fb /tests/ajdoc/common/OutputComparator.java | |
parent | fafae443719b26159ab2d7dac1c9b46b5e00b671 (diff) | |
download | aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip |
initial version
Diffstat (limited to 'tests/ajdoc/common/OutputComparator.java')
-rw-r--r-- | tests/ajdoc/common/OutputComparator.java | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/ajdoc/common/OutputComparator.java b/tests/ajdoc/common/OutputComparator.java new file mode 100644 index 000000000..130f4d857 --- /dev/null +++ b/tests/ajdoc/common/OutputComparator.java @@ -0,0 +1,35 @@ +package common; + +import java.io.*; +import java.util.Vector; + +public class OutputComparator +{ + /** + * Ignores lines that contain "Generated by javadoc on". + * + * @return the lines that don't match in the two files as a Vector of Strings, + * or null if they are the same. + */ + public Vector compareFilesByLine(String file1, String file2) throws IOException { + Vector diffLines = new Vector(); + BufferedReader reader1 = new BufferedReader(new FileReader(file1)); + BufferedReader reader2 = new BufferedReader(new FileReader(file2)); + String line1 = reader1.readLine(); + String line2 = reader2.readLine(); + while (line1 != null && line2 != null) { + if (!line1.trim().equals(line2.trim()) && + line1.indexOf("Generated by javadoc on") == -1 ) { + diffLines.addElement(line1 + " != " + line2); + } + line1 = reader1.readLine(); + line2 = reader2.readLine(); + } + if (diffLines.size() == 0) { + return null; + } + else { + return diffLines; + } + } +} |