Package org.fest.assertions.internal
Class Files
java.lang.Object
org.fest.assertions.internal.Files
Reusable assertions for
File
s.- Author:
- David DIDIER, Yvonne Wang, Alex Ruiz, Olivier Demeijer
-
Method Summary
Modifier and TypeMethodDescriptionvoid
assertCanRead
(AssertionInfo info, File actual) Asserts that the given file can be read by the application.void
assertCanWrite
(AssertionInfo info, File actual) Asserts that the given file can be modified by the application.void
assertDoesNotExist
(AssertionInfo info, File actual) Asserts that the given file does not exist.void
assertEqualContent
(AssertionInfo info, File actual, File expected) Asserts that the given files have equal content.void
assertExists
(AssertionInfo info, File actual) Asserts that the given file exists, regardless it's a file or directory.void
assertHasBinaryContent
(AssertionInfo info, File actual, byte[] expected) Asserts that the given file has the given binary content.void
assertHasContent
(AssertionInfo info, File actual, String expected, Charset charset) Asserts that the given file has the given text content.void
assertIsAbsolute
(AssertionInfo info, File actual) Asserts that the given file is an absolute path.void
assertIsDirectory
(AssertionInfo info, File actual) Asserts that the given file is an existing directory.void
assertIsFile
(AssertionInfo info, File actual) Asserts that the given file is an existing file.void
assertIsRelative
(AssertionInfo info, File actual) Asserts that the given file is a relative path.static Files
instance()
Returns the singleton instance of this class.
-
Method Details
-
instance
Returns the singleton instance of this class.- Returns:
- the singleton instance of this class.
-
assertEqualContent
Asserts that the given files have equal content. Adapted from FileAssert (from JUnit-addons.)- Parameters:
info
- contains information about the assertion.actual
- the "actual" file.expected
- the "expected" file.- Throws:
NullPointerException
- ifexpected
isnull
.IllegalArgumentException
- ifexpected
is not an existing file.AssertionError
- ifactual
isnull
.AssertionError
- ifactual
is not an existing file.org.fest.util.FilesException
- if an I/O error occurs.AssertionError
- if the given files do not have equal content.
-
assertHasBinaryContent
Asserts that the given file has the given binary content.- Parameters:
info
- contains information about the assertion.actual
- the "actual" file.expected
- the "expected" binary content.- Throws:
NullPointerException
- ifexpected
isnull
.AssertionError
- ifactual
isnull
.AssertionError
- ifactual
is not an existing file.org.fest.util.FilesException
- if an I/O error occurs.AssertionError
- if the file does not have the binary content.
-
assertHasContent
Asserts that the given file has the given text content.- Parameters:
info
- contains information about the assertion.actual
- the "actual" file.expected
- the "expected" text content.charset
- the charset to use to read the file.- Throws:
NullPointerException
- ifexpected
isnull
.AssertionError
- ifactual
isnull
.AssertionError
- ifactual
is not an existing file.org.fest.util.FilesException
- if an I/O error occurs.AssertionError
- if the file does not have the text content.
-
assertIsFile
Asserts that the given file is an existing file.- Parameters:
info
- contains information about the assertion.actual
- the given file.- Throws:
AssertionError
- if the given file isnull
.AssertionError
- if the given file is not an existing file.
-
assertIsDirectory
Asserts that the given file is an existing directory.- Parameters:
info
- contains information about the assertion.actual
- the given file.- Throws:
AssertionError
- if the given file isnull
.AssertionError
- if the given file is not an existing directory.
-
assertIsAbsolute
Asserts that the given file is an absolute path.- Parameters:
info
- contains information about the assertion.actual
- the given file.- Throws:
AssertionError
- if the given file isnull
.AssertionError
- if the given file is not an absolute path.
-
assertIsRelative
Asserts that the given file is a relative path.- Parameters:
info
- contains information about the assertion.actual
- the given file.- Throws:
AssertionError
- if the given file isnull
.AssertionError
- if the given file is not a relative path.
-
assertExists
Asserts that the given file exists, regardless it's a file or directory.- Parameters:
info
- contains information about the assertion.actual
- the given file.- Throws:
AssertionError
- if the given file isnull
.AssertionError
- if the given file does not exist.
-
assertDoesNotExist
Asserts that the given file does not exist.- Parameters:
info
- contains information about the assertion.actual
- the given file.- Throws:
AssertionError
- if the given file isnull
.AssertionError
- if the given file exists.
-
assertCanWrite
Asserts that the given file can be modified by the application.- Parameters:
info
- contains information about the assertion.actual
- the given file.- Throws:
AssertionError
- if the given file isnull
.AssertionError
- if the given file can not be modified.
-
assertCanRead
Asserts that the given file can be read by the application.- Parameters:
info
- contains information about the assertion.actual
- the given file.- Throws:
AssertionError
- if the given file isnull
.AssertionError
- if the given file can not be modified.
-