|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fest.assertions.Assert
org.fest.assertions.GenericAssert<File>
org.fest.assertions.FileAssert
public class FileAssert
Understands assertion methods for File
. To create a new instance of this class use the method
.
Assertions.assertThat(File)
Field Summary |
---|
Fields inherited from class org.fest.assertions.GenericAssert |
---|
actual |
Constructor Summary | |
---|---|
protected |
FileAssert(File actual)
Creates a new FileAssert . |
Method Summary | |
---|---|
FileAssert |
as(Description description)
Sets the description of the actual value, to be used in as message of any
thrown when an assertion fails. |
FileAssert |
as(String description)
Sets the description of the actual value, to be used in as message of any
thrown when an assertion fails. |
FileAssert |
describedAs(Description description)
Alias for , since "as" is a keyword in
Groovy. |
FileAssert |
describedAs(String description)
Alias for , since "as" is a keyword in
Groovy. |
FileAssert |
doesNotExist()
Verifies that the actual File does not exist. |
FileAssert |
doesNotSatisfy(Condition<File> condition)
Verifies that the actual File does not satisfy the given condition. |
FileAssert |
exists()
Verifies that the actual File does exist. |
FileAssert |
hasSameContentAs(File expected)
Verifies that the content of the actual File is equal to the content of the given one. |
FileAssert |
hasSize(long expected)
Verifies that the size of the actual File is equal to the given one. |
FileAssert |
is(Condition<File> condition)
Verifies that the actual File satisfies the given condition. |
FileAssert |
isAbsolute()
Verifies that the actual File is an absolute path. |
FileAssert |
isDirectory()
Verifies that the actual File is a directory. |
FileAssert |
isEqualTo(File expected)
Verifies that the actual File is equal to the given one. |
FileAssert |
isFile()
Verifies that the actual File is a regular file. |
FileAssert |
isNot(Condition<File> condition)
Verifies that the actual File does not satisfy the given condition. |
FileAssert |
isNotEqualTo(File other)
Verifies that the actual File is not equal to the given one. |
FileAssert |
isNotNull()
Verifies that the actual File is not null . |
FileAssert |
isNotSameAs(File other)
Verifies that the actual File is not the same as the given one. |
FileAssert |
isRelative()
Verifies that the actual File is a relative path. |
FileAssert |
isSameAs(File expected)
Verifies that the actual File is the same as the given one. |
FileAssert |
overridingErrorMessage(String message)
Replaces the default message displayed in case of a failure with the given one. |
FileAssert |
satisfies(Condition<File> condition)
Verifies that the actual File satisfies the given condition. |
Methods inherited from class org.fest.assertions.GenericAssert |
---|
assertDoesNotSatisfy, assertEqualTo, assertIs, assertIsNot, assertNotEqualTo, assertNotNull, assertNotSameAs, assertSameAs, assertSatisfies, isNull |
Methods inherited from class org.fest.assertions.Assert |
---|
customErrorMessage, description, description, description, equals, fail, fail, failIfCustomMessageIsSet, failIfCustomMessageIsSet, failure, formattedErrorMessage, hashCode, rawDescription, replaceDefaultErrorMessagesWith |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected FileAssert(File actual)
FileAssert
.
actual
- the target to verify.Method Detail |
---|
public FileAssert as(String description)
AssertionError
thrown when an assertion fails. This method should be called before any assertion method, otherwise any assertion
failure will not show the provided description.
For example:
assertThat(val).as("name").isEqualTo("Frodo");
as
in class GenericAssert<File>
description
- the description of the actual value.
public FileAssert describedAs(String description)
GenericAssert.as(String)
, since "as" is a keyword in
Groovy. This method should be called before any assertion
method, otherwise any assertion failure will not show the provided description.
For example:
assertThat(val).describedAs("name").isEqualTo("Frodo");
describedAs
in class GenericAssert<File>
description
- the description of the actual value.
public FileAssert as(Description description)
AssertionError
thrown when an assertion fails. This method should be called before any assertion method, otherwise any assertion
failure will not show the provided description.
For example:
assertThat(val).as(new BasicDescription("name")).isEqualTo("Frodo");
as
in class GenericAssert<File>
description
- the description of the actual value.
public FileAssert describedAs(Description description)
GenericAssert.as(Description)
, since "as" is a keyword in
Groovy. This method should be called before any assertion
method, otherwise any assertion failure will not show the provided description.
For example:
assertThat(val).describedAs(new BasicDescription("name")).isEqualTo("Frodo");
describedAs
in class GenericAssert<File>
description
- the description of the actual value.
public FileAssert doesNotExist()
File
does not exist.
AssertionError
- if the the actual File
is null
.
AssertionError
- if the actual File
exists.public FileAssert exists()
File
does exist.
AssertionError
- if the the actual File
is null
.
AssertionError
- if the actual File
does not exist.public FileAssert hasSize(long expected)
File
is equal to the given one.
expected
- the expected size of the actual File
.
AssertionError
- if the the actual File
is null
.
AssertionError
- if the size of the actual File
is not equal to the given one.public FileAssert isDirectory()
File
is a directory.
AssertionError
- if the the actual File
is null
.
AssertionError
- if the actual File
is not a directory.public FileAssert isEqualTo(File expected)
File
is equal to the given one. To verify that the actual File
has the same content as another File
, use hasSameContentAs(File)
.
isEqualTo
in class GenericAssert<File>
expected
- the given File
to compare the actual File
to.
AssertionError
- if the actual File
is not equal to the given one.public FileAssert isFile()
File
is a regular file.
AssertionError
- if the the actual File
is null
.
AssertionError
- if the actual File
is not a regular file.public FileAssert isNotEqualTo(File other)
File
is not equal to the given one.
isNotEqualTo
in class GenericAssert<File>
other
- the given File
to compare the actual File
to.
AssertionError
- if the actual File
is equal to the given one.public FileAssert isNotNull()
File
is not null
.
isNotNull
in class GenericAssert<File>
AssertionError
- if the actual File
is null
.public FileAssert isNotSameAs(File other)
File
is not the same as the given one.
isNotSameAs
in class GenericAssert<File>
other
- the given File
to compare the actual File
to.
AssertionError
- if the actual File
is the same as the given one.public FileAssert isSameAs(File expected)
File
is the same as the given one.
isSameAs
in class GenericAssert<File>
expected
- the given File
to compare the actual File
to.
AssertionError
- if the actual File
is not the same as the given one.public FileAssert satisfies(Condition<File> condition)
File
satisfies the given condition.
satisfies
in class GenericAssert<File>
condition
- the given condition.
NullPointerException
- if the given condition is null
.
AssertionError
- if the actual File
does not satisfy the given condition.is(Condition)
public FileAssert doesNotSatisfy(Condition<File> condition)
File
does not satisfy the given condition.
doesNotSatisfy
in class GenericAssert<File>
condition
- the given condition.
AssertionError
- if the actual File
satisfies the given condition.
NullPointerException
- if the given condition is null
.isNot(Condition)
public FileAssert is(Condition<File> condition)
File
satisfies the given condition.
is
in class GenericAssert<File>
condition
- the given condition.
NullPointerException
- if the given condition is null
.
AssertionError
- if the actual File
does not satisfy the given condition.public FileAssert isNot(Condition<File> condition)
File
does not satisfy the given condition.
isNot
in class GenericAssert<File>
condition
- the given condition.
AssertionError
- if the actual File
satisfies the given condition.
NullPointerException
- if the given condition is null
.public FileAssert hasSameContentAs(File expected)
File
is equal to the content of the given one. Adapted from
FileAssert (from
JUnit-addons.)
expected
- the given File
to compare the actual File
to.
NullPointerException
- if the file to compare to is null
.
AssertionError
- if the the actual File
is null
.
AssertionError
- if the content of the actual File
is not equal to the content of the given one.public FileAssert isRelative()
File
is a relative path.
AssertionError
- if the actual File
is not a relative path.public FileAssert isAbsolute()
File
is an absolute path.
AssertionError
- if the actual File
is not an absolute path.public FileAssert overridingErrorMessage(String message)
For example, the following assertion:
assertThat("Hello").isEqualTo("Bye");will fail with the default message "expected:<'[Bye]'> but was:<'[Hello]'>."
We can replace this message with our own:
assertThat("Hello").overridingErrorMessage("'Hello' should be equal to 'Bye'").isEqualTo("Bye");in this case, the assertion will fail showing the message "'Hello' should be equal to 'Bye'".
overridingErrorMessage
in class GenericAssert<File>
message
- the given error message, which will replace the default one.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |