ch.sahits.test
Class FileComparator

java.lang.Object
  extended by ch.sahits.test.FileComparator

public final class FileComparator
extends java.lang.Object

This file comparator can compare to text based files.

Since:
2.1.0
Author:
Andi Hotz, Sahits GmbH

Constructor Summary
FileComparator(java.lang.String fileName)
          Initialize this instance with the instance with the file to be compared to
 
Method Summary
 ComparetorResult equals(java.lang.String fileName)
          Compare the file denoted by fileName to the file initialized in the constructor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileComparator

public FileComparator(java.lang.String fileName)
               throws java.io.FileNotFoundException
Initialize this instance with the instance with the file to be compared to

Parameters:
fileName - absolute path to the file
Throws:
java.io.FileNotFoundException - fileName was not a valid path
Method Detail

equals

public ComparetorResult equals(java.lang.String fileName)
                        throws java.io.IOException
Compare the file denoted by fileName to the file initialized in the constructor. The comparison ignores empty lines. Multiple spaces and tabs are handled as a single space. Tow textual files are equal under the above assumptions when every line of the file is equal.

Parameters:
fileName - absolute path of the file to compare this to
Returns:
Instance that holds the result of the comparison
Throws:
java.io.FileNotFoundException - fileName was not a valid path
java.io.IOException - Error during the reading of the file