Class IOTester
- java.lang.Object
-
- patterntesting.runtime.junit.IOTester
-
public final class IOTester extends java.lang.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
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
assertContentEquals(java.io.BufferedReader r1, java.io.BufferedReader r2)
Asserts that the content of two Readers are equal.static void
assertContentEquals(java.io.InputStream in1, java.io.InputStream in2)
Asserts that the content of two InputStream are equal.static void
assertContentEquals(java.io.InputStream in1, java.io.InputStream in2, int from, int to)
Asserts that the content of two InputStream are equal.static void
assertContentEquals(java.io.InputStream in1, java.io.InputStream in2, java.nio.charset.Charset encoding)
Asserts that the content of two InputStream are equal.static void
assertContentEquals(java.io.InputStream in1, java.io.InputStream in2, java.nio.charset.Charset encoding, int from, int to)
Asserts that the content of two InputStream are equal.static void
assertContentEquals(java.io.InputStream in1, java.io.InputStream in2, java.nio.charset.Charset encoding, java.util.regex.Pattern... ignores)
Asserts that the content of two Readers are equal.static void
assertContentEquals(java.io.InputStream in1, java.io.InputStream in2, java.util.regex.Pattern... ignores)
Asserts that the content of two Readers are equal.static void
assertContentEquals(java.io.Reader r1, java.io.Reader r2)
Asserts that the content of two Readers are equal.static void
assertContentEquals(java.io.Reader r1, java.io.Reader r2, int from, int to)
Asserts that the content of two Readers are equal.static void
assertContentEquals(java.io.Reader r1, java.io.Reader r2, java.util.regex.Pattern... ignores)
Asserts that the content of two Readers are equal.static void
assertContentEquals(java.io.Reader r1, java.io.Reader r2, StringConverter converter)
Asserts that the content of two Readers are equal.static void
assertContentEquals(java.io.Reader r1, java.io.Reader r2, StringConverter converter, java.util.regex.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, java.util.regex.Pattern... ignores)
Asserts that the content of two Readers are equal.static void
assertContentEquals(LineReader r1, LineReader r2, StringConverter converter, java.util.regex.Pattern[] ignores)
Asserts that the content of two Readers are equal.
-
-
-
Method Detail
-
assertContentEquals
public static void assertContentEquals(java.io.InputStream in1, java.io.InputStream in2) throws java.lang.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 InputStreamin2
- the second InputStream- Throws:
java.lang.AssertionError
- if the check fails
-
assertContentEquals
public static void assertContentEquals(java.io.InputStream in1, java.io.InputStream in2, java.nio.charset.Charset encoding) throws java.lang.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 InputStreamin2
- the second InputStreamencoding
- the encoding- Throws:
java.lang.AssertionError
- if the check fails
-
assertContentEquals
public static void assertContentEquals(java.io.InputStream in1, java.io.InputStream in2, int from, int to) throws java.lang.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 InputStreamin2
- the second InputStreamfrom
- the line number from which the comparison is started (starting with 1)to
- the last line number where the comparison ends.- Throws:
java.lang.AssertionError
- if the check fails
-
assertContentEquals
public static void assertContentEquals(java.io.InputStream in1, java.io.InputStream in2, java.nio.charset.Charset encoding, int from, int to) throws java.lang.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 InputStreamin2
- the second InputStreamencoding
- the encodingfrom
- the line number from which the comparison is started (starting with 1)to
- the last line number where the comparison ends.- Throws:
java.lang.AssertionError
- if the check fails
-
assertContentEquals
public static void assertContentEquals(java.io.InputStream in1, java.io.InputStream in2, java.util.regex.Pattern... ignores) throws java.lang.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 InputStreamin2
- the second InputStreamignores
- the lines matching this pattern will be ignored- Throws:
java.lang.AssertionError
- if the check fails
-
assertContentEquals
public static void assertContentEquals(java.io.InputStream in1, java.io.InputStream in2, java.nio.charset.Charset encoding, java.util.regex.Pattern... ignores) throws java.lang.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 InputStreamin2
- the second InputStreamencoding
- the encodingignores
- the lines matching this pattern will be ignored- Throws:
java.lang.AssertionError
- if the check fails
-
assertContentEquals
public static void assertContentEquals(java.io.Reader r1, java.io.Reader r2) throws java.lang.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 Readerr2
- the second Reader- Throws:
java.lang.AssertionError
- if the check fails
-
assertContentEquals
public static void assertContentEquals(java.io.Reader r1, java.io.Reader r2, int from, int to) throws java.lang.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 Readerr2
- the second Readerfrom
- the line number from which the comparison is started (starting with 1)to
- the last line number where the comparison ends.- Throws:
java.lang.AssertionError
- if the check fails
-
assertContentEquals
public static void assertContentEquals(java.io.Reader r1, java.io.Reader r2, java.util.regex.Pattern... ignores) throws java.lang.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 Readerr2
- the second Readerignores
- the lines matching this pattern will be ignored- Throws:
java.lang.AssertionError
- if the check fails
-
assertContentEquals
public static void assertContentEquals(java.io.Reader r1, java.io.Reader r2, StringConverter converter) throws java.lang.AssertionError
Asserts that the content of two Readers are equal. If they are not equals the first different line or byte will be shown.For comparison the lines are converted before by the given
StringConverter
. This allows you e.g. to ignore white spaces (by usingStringConverter.IGNORE_WHITESPACES
as parameter) or to ignore upper / lower case problems (StringConverter.LOWER_CASE
).- Parameters:
r1
- the first Readerr2
- the second Readerconverter
- the converter- Throws:
java.lang.AssertionError
- if the check fails- Since:
- 1.6
-
assertContentEquals
public static void assertContentEquals(java.io.BufferedReader r1, java.io.BufferedReader r2) throws java.lang.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 Readerr2
- the second Reader- Throws:
java.lang.AssertionError
- if the check fails
-
assertContentEquals
public static void assertContentEquals(LineReader r1, LineReader r2, int from, int to) throws java.lang.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 Readerr2
- the second Readerfrom
- the line number from which the comparison is started (starting with 1)to
- the last line number where the comparison ends.- Throws:
java.lang.AssertionError
- if the check fails
-
assertContentEquals
public static void assertContentEquals(LineReader r1, LineReader r2, java.util.regex.Pattern... ignores) throws java.lang.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 Readerr2
- the second Readerignores
- the lines matching this pattern will be ignored- Throws:
java.lang.AssertionError
- if the check fails
-
assertContentEquals
public static void assertContentEquals(java.io.Reader r1, java.io.Reader r2, StringConverter converter, java.util.regex.Pattern[] ignores)
Asserts that the content of two Readers are equal. If they are not equals the first different line or byte will be shown.For comparison the lines are converted before by the given
StringConverter
. This allows you e.g. to ignore white spaces (by usingStringConverter.IGNORE_WHITESPACES
as parameter) or to ignore upper / lower case problems (StringConverter.LOWER_CASE
).Lines which matches the given 'ignores' pattern will be ignored for comparison. This is done before the converter is executed. E.g. the 'ignores' pattern must match the original line.
- Parameters:
r1
- the r1r2
- the r2converter
- the converterignores
- the ignores- Since:
- 1.6
-
assertContentEquals
public static void assertContentEquals(LineReader r1, LineReader r2, StringConverter converter, java.util.regex.Pattern[] ignores)
Asserts that the content of two Readers are equal. If they are not equals the first different line or byte will be shown.For comparison the lines are converted before by the given
StringConverter
. This allows you e.g. to ignore white spaces (by usingStringConverter.IGNORE_WHITESPACES
as parameter) or to ignore upper / lower case problems (StringConverter.LOWER_CASE
).Lines which matches the given 'ignores' pattern will be ignored for comparison. This is done before the converter is executed. E.g. the 'ignores' pattern must match the original line.
- Parameters:
r1
- the r1r2
- the r2converter
- the converterignores
- the ignores
-
-