patterntesting.runtime.junit
Class FileTester

Package class diagram package FileTester
java.lang.Object
  extended by patterntesting.runtime.junit.FileTester

public class FileTester
extends Object

The Class FileTester.

Since:
1.1 (06.04.2011)
Author:
oliver

Method Summary
static void assertContentEquals(File file1, File file2)
          Asserts that the content of two files are equal.
static void assertContentEquals(File file1, File file2, Charset encoding)
          Asserts that the content of two files are equal.
static void assertContentEquals(File file1, File file2, Charset encoding, Pattern... ignores)
          Asserts that the content of two files are equal.
static void assertContentEquals(File file1, File file2, int from, int to)
          Asserts that the content of two files are equal.
static void assertContentEquals(File file1, File file2, int from, int to, Charset encoding)
          Asserts that the content of two files are equal.
static void assertContentEquals(File file1, File file2, int from, int to, String encoding)
          Asserts that the content of two files are equal.
static void assertContentEquals(File file1, File file2, Pattern... ignores)
          Asserts that the content of two files are equal.
static void assertContentEquals(File file1, File file2, String encoding)
          Asserts that the content of two files are equal.
static void assertEquals(File file1, File file2)
          Two files are considered equals if the would point to the same file location on the disk.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

assertContentEquals

public static void assertContentEquals(File file1,
                                       File file2)
                                throws AssertionError
Asserts that the content of two files are equal. If they are not equals the first different line or byte will be shown.

Parameters:
file1 - the first file
file2 - the second file
Throws:
AssertionError - if the check fails

assertContentEquals

public static void assertContentEquals(File file1,
                                       File file2,
                                       int from,
                                       int to)
                                throws AssertionError
Asserts that the content of two files are equal. If they are not equals the first different line or byte will be shown.

Parameters:
file1 - the first file
file2 - the second file
from - the line number from which the comparison is started (starting with 1)
to - the last line number where the comparison ends.
Throws:
AssertionError - if the check fails

assertContentEquals

public static void assertContentEquals(File file1,
                                       File file2,
                                       String encoding)
                                throws AssertionError
Asserts that the content of two files are equal. If they are not equals the first different line or byte will be shown.

The encoding is only important for the output if the two files are not equals.

Parameters:
file1 - the first file
file2 - the second file
encoding - the encoding
Throws:
AssertionError - if the check fails

assertContentEquals

public static void assertContentEquals(File file1,
                                       File file2,
                                       int from,
                                       int to,
                                       String encoding)
                                throws AssertionError
Asserts that the content of two files are equal. If they are not equals the first different line or byte will be shown.

The encoding is only important for the output if the two files are not equals.

Parameters:
file1 - the first file
file2 - the second file
from - the line number from which the comparison is started (starting with 1)
to - the last line number where the comparison ends.
encoding - the encoding
Throws:
AssertionError - if the check fails

assertContentEquals

public static void assertContentEquals(File file1,
                                       File file2,
                                       Charset encoding)
                                throws AssertionError
Asserts that the content of two files are equal. If they are not equals the first different line or byte will be shown.

The encoding is only important for the output if the two files are not equals.

Parameters:
file1 - the first file
file2 - the second file
encoding - the encoding
Throws:
AssertionError - if the check fails

assertContentEquals

public static void assertContentEquals(File file1,
                                       File file2,
                                       int from,
                                       int to,
                                       Charset encoding)
                                throws AssertionError
Asserts that the content of two files are equal. If they are not equals the first different line or byte will be shown.

The encoding is only important for the output if the two files are not equals.

Parameters:
file1 - the first file
file2 - the second file
from - the line number from which the comparison is started (starting with 1)
to - the last line number where the comparison ends.
encoding - the encoding
Throws:
AssertionError - if the check fails

assertContentEquals

public static void assertContentEquals(File file1,
                                       File file2,
                                       Pattern... ignores)
                                throws AssertionError
Asserts that the content of two files are equal. Lines which matches the given 'ignores' pattern will be ignored for comparison. E.g. if you want to ignore two property files and want to ignore the comments and empty lines you could use
     Pattern.compile("#.*"), Pattern.compile("[ \\t]*"
 
as ignores parameters.

If the two files are not equals the first different line or byte will be shown.

Parameters:
file1 - the first file
file2 - the second file
ignores - the line pattern which should be ignored
Throws:
AssertionError - if the check fails
Since:
1.4
See Also:
assertContentEquals(File, File, Charset, Pattern...)

assertContentEquals

public static void assertContentEquals(File file1,
                                       File file2,
                                       Charset encoding,
                                       Pattern... ignores)
                                throws AssertionError
Asserts that the content of two files are equal. Lines which matches the given 'ignores' pattern will be ignored for comparison. E.g. if you want to ignore two property files and want to ignore the comments and empty lines you could use
     Pattern.compile("#.*"), Pattern.compile("[ \\t]*"
 
as ignores parameters.

If the two files are not equals the first different line or byte will be shown.

Parameters:
file1 - the first file
file2 - the second file
encoding - the file encoding
ignores - the line pattern which should be ignored
Throws:
AssertionError - if the check fails
Since:
1.4

assertEquals

public static void assertEquals(File file1,
                                File file2)
Two files are considered equals if the would point to the same file location on the disk.

Parameters:
file1 - e.g. file "/a/b/c"
file2 - e.g. file "/a/b/../b/c"


Copyright © 2002–2014 PatternTesting Team. All rights reserved.