public class FileComparator extends junit.framework.TestCase
Constructor and Description |
---|
FileComparator(String testName,
File expectedFile,
File actualFile,
boolean binary)
Constructs a new instance of the FileComparator.
|
FileComparator(String testName,
File expectedFile,
File actualFile,
boolean binary,
boolean ignoreWhitespace,
boolean ignoreLineEndings,
List<String> ignoreLinesWithStrings)
Constructs a new instance of the FileComparator.
|
Modifier and Type | Method and Description |
---|---|
File |
getActualFile()
Gets the actual file being compared.
|
File |
getExpectedFile()
Gets the file expected file (i.e.
|
String |
removeLinesWithStrings(String input,
List<String> patternList) |
protected void |
testContentsEqual()
Loads both the
actual and expected files
and tests the contents for equality. |
void |
testEquals()
Test if actual and expected file contents are equal.
|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
public FileComparator(String testName, File expectedFile, File actualFile, boolean binary)
testName
- the name of the test to runexpectedFile
- the location of the expected fileactualFile
- the location of the actual file.binary
- whether or not the file is binary, if it is binary contents
of the binary are not compared as Strings but as binary files.public FileComparator(String testName, File expectedFile, File actualFile, boolean binary, boolean ignoreWhitespace, boolean ignoreLineEndings, List<String> ignoreLinesWithStrings)
testName
- the name of the test to runexpectedFile
- the location of the expected fileactualFile
- the location of the actual file.binary
- whether or not the file is binary, if it is binary contents
of the binary are not compared as Strings but as binary files.ignoreWhitespace
- Ignore whitespace in the comparisonignoreLineEndings
- Ignore Unix/Windows line ending differences \r vs \r\nignoreLinesWithStrings
- Ignore lines containing the strings in the comparisonpublic void testEquals()
protected void testContentsEqual()
actual
and expected
files
and tests the contents for equality.public String removeLinesWithStrings(String input, List<String> patternList)
input
- patternList
- public File getActualFile()
public File getExpectedFile()
Copyright © 2005–2014 AndroMDA.org. All rights reserved.