patterntesting.runtime.junit
Class IOTester

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

public final class IOTester
extends Object

With the IOTester you can assert if two files have equals content or if two directories have the same structure with equal files.
Note: This test is not yet tested with binary files.

Since:
1.1 (30.03.2011)
Author:
oliver

Method Summary
static void assertContentEquals(BufferedReader r1, BufferedReader r2)
          Asserts that the content of two Readers are equal.
static void assertContentEquals(InputStream in1, InputStream in2)
          Asserts that the content of two InputStream are equal.
static void assertContentEquals(InputStream in1, InputStream in2, Charset encoding)
          Asserts that the content of two InputStream are equal.
static void assertContentEquals(InputStream in1, InputStream in2, Charset encoding, int from, int to)
          Asserts that the content of two InputStream are equal.
static void assertContentEquals(InputStream in1, InputStream in2, Charset encoding, Pattern... ignores)
          Asserts that the content of two Readers are equal.
static void assertContentEquals(InputStream in1, InputStream in2, int from, int to)
          Asserts that the content of two InputStream are equal.
static void assertContentEquals(InputStream in1, InputStream in2, Pattern... ignores)
          Asserts that the content of two Readers are equal.
static void assertContentEquals(LineReader r1, LineReader r2, int from, int to)
          Asserts that the content of two Readers are equal.
static void assertContentEquals(LineReader r1, LineReader r2, Pattern... ignores)
          Asserts that the content of two Readers are equal.
static void assertContentEquals(Reader r1, Reader r2)
          Asserts that the content of two Readers are equal.
static void assertContentEquals(Reader r1, Reader r2, int from, int to)
          Asserts that the content of two Readers are equal.
static void assertContentEquals(Reader r1, Reader r2, Pattern... ignores)
          Asserts that the content of two Readers are equal.
 
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(InputStream in1,
                                       InputStream in2)
                                throws AssertionError
Asserts that the content of two InputStream are equal. If they are not equals the first different line or byte will be shown.

Parameters:
in1 - the first InputStream
in2 - the second InputStream
Throws:
AssertionError - if the check fails

assertContentEquals

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

Parameters:
in1 - the first InputStream
in2 - the second InputStream
encoding - the encoding
Throws:
AssertionError - if the check fails

assertContentEquals

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

Parameters:
in1 - the first InputStream
in2 - the second InputStream
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(InputStream in1,
                                       InputStream in2,
                                       Charset encoding,
                                       int from,
                                       int to)
                                throws AssertionError
Asserts that the content of two InputStream are equal. If they are not equals the first different line or byte will be shown.

Parameters:
in1 - the first InputStream
in2 - the second InputStream
encoding - the encoding
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(InputStream in1,
                                       InputStream in2,
                                       Pattern... ignores)
                                throws AssertionError
Asserts that the content of two Readers are equal. If they are not equals the first different line or byte will be shown.

Parameters:
in1 - the first InputStream
in2 - the second InputStream
ignores - the lines matching this pattern will be ignored
Throws:
AssertionError - if the check fails

assertContentEquals

public static void assertContentEquals(InputStream in1,
                                       InputStream in2,
                                       Charset encoding,
                                       Pattern... ignores)
                                throws AssertionError
Asserts that the content of two Readers are equal. If they are not equals the first different line or byte will be shown.

Parameters:
in1 - the first InputStream
in2 - the second InputStream
encoding - the encoding
ignores - the lines matching this pattern will be ignored
Throws:
AssertionError - if the check fails

assertContentEquals

public static void assertContentEquals(Reader r1,
                                       Reader r2)
                                throws AssertionError
Asserts that the content of two Readers are equal. If they are not equals the first different line or byte will be shown.

Parameters:
r1 - the first Reader
r2 - the second Reader
Throws:
AssertionError - if the check fails

assertContentEquals

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

Parameters:
r1 - the first Reader
r2 - the second Reader
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(Reader r1,
                                       Reader r2,
                                       Pattern... ignores)
                                throws AssertionError
Asserts that the content of two Readers are equal. If they are not equals the first different line or byte will be shown.

Parameters:
r1 - the first Reader
r2 - the second Reader
ignores - the lines matching this pattern will be ignored
Throws:
AssertionError - if the check fails

assertContentEquals

public static void assertContentEquals(BufferedReader r1,
                                       BufferedReader r2)
                                throws AssertionError
Asserts that the content of two Readers are equal. If they are not equals the first different line or byte will be shown.

Parameters:
r1 - the first Reader
r2 - the second Reader
Throws:
AssertionError - if the check fails

assertContentEquals

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

Parameters:
r1 - the first Reader
r2 - the second Reader
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(LineReader r1,
                                       LineReader r2,
                                       Pattern... ignores)
                                throws AssertionError
Asserts that the content of two Readers are equal. If they are not equals the first different line or byte will be shown.

Parameters:
r1 - the first Reader
r2 - the second Reader
ignores - the lines matching this pattern will be ignored
Throws:
AssertionError - if the check fails


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