Class FileAssert
java.lang.Object
org.testng.FileAssert
Assertion tool for File centric assertions. Conceptually, this is an extension of
Assert.
Presents assertion methods with a more natural parameter order. The order is always
actualValue, expectedValue [, message].- Since:
- 5.6
- Author:
- Paul Mendelon
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidassertDirectory(File tstvalue) static voidassertDirectory(File tstvalue, String message) Asserts that atstvalueis a proper directory.static voidassertFile(File tstvalue) static voidassertFile(File tstvalue, String message) Asserts that atstvalueis a proper file.static voidassertLength(File tstvalue, long expected) static voidassertLength(File tstvalue, long expected, String message) Asserts that atstvalueis a file of exactlyexpectedcharacters or a directory of exactlyexpectedentries.static voidassertMaxLength(File tstvalue, long expected) static voidassertMaxLength(File tstvalue, long expected, String message) Asserts that atstvalueis a file of at mostexpectedcharacters or a directory of at mostexpectedentries.static voidassertMinLength(File tstvalue, long expected) static voidassertMinLength(File tstvalue, long expected, String message) Asserts that atstvalueis a file of at leastexpectedcharacters or a directory of at leastexpectedentries.static voidassertReadable(File tstvalue) static voidassertReadable(File tstvalue, String message) Asserts that atstvalueis readable.static voidassertReadWrite(File tstvalue) static voidassertReadWrite(File tstvalue, String message) Asserts that atstvalueis readable and writeable.static voidassertWriteable(File tstvalue) static voidassertWriteable(File tstvalue, String message) Asserts that atstvalueis writeable.static voidfail()Fails a test with no message.static voidFails a test with the given message.static voidFails a test with the given message and wrapping the original exception.
-
Method Details
-
assertDirectory
-
assertDirectory
-
assertFile
-
assertFile
- Parameters:
tstvalue- The actual file- See Also:
-
assertLength
Asserts that atstvalueis a file of exactlyexpectedcharacters or a directory of exactlyexpectedentries. If it isn't, an AssertionError with the given message is thrown.- Parameters:
tstvalue- the file to evaluateexpected- the expected valuemessage- the assertion error message
-
assertLength
- Parameters:
tstvalue- The actual fileexpected- The expected length- See Also:
-
assertMinLength
Asserts that atstvalueis a file of at leastexpectedcharacters or a directory of at leastexpectedentries. If it isn't, an AssertionError with the given message is thrown.- Parameters:
tstvalue- the file to evaluateexpected- the expected valuemessage- the assertion error message
-
assertMinLength
- Parameters:
tstvalue- The actual fileexpected- The expected min length- See Also:
-
assertMaxLength
Asserts that atstvalueis a file of at mostexpectedcharacters or a directory of at mostexpectedentries. If it isn't, an AssertionError with the given message is thrown.- Parameters:
tstvalue- the file to evaluateexpected- The expected max lengthmessage- the assertion error message
-
assertMaxLength
- Parameters:
tstvalue- The actual fileexpected- The expected length- See Also:
-
assertReadable
-
assertReadable
- Parameters:
tstvalue- The actual file- See Also:
-
assertWriteable
-
assertWriteable
- Parameters:
tstvalue- The actual file- See Also:
-
assertReadWrite
-
assertReadWrite
- Parameters:
tstvalue- The actual file- See Also:
-
fail
-
fail
Fails a test with the given message.- Parameters:
message- the assertion error message
-
fail
public static void fail()Fails a test with no message.
-