org.fest.assertions.api
Class FileAssert

java.lang.Object
  extended by org.fest.assertions.api.AbstractAssert<FileAssert,File>
      extended by org.fest.assertions.api.FileAssert
All Implemented Interfaces:
Assert<FileAssert,File>, Descriptable<FileAssert>, ExtensionPoints<FileAssert,File>

public class FileAssert
extends AbstractAssert<FileAssert,File>

Assertion methods for Files.

To create a new instance of this class, invoke Assertions.assertThat(File).

Author:
David DIDIER, Yvonne Wang, Alex Ruiz

Field Summary
 
Fields inherited from class org.fest.assertions.api.AbstractAssert
actual, myself
 
Constructor Summary
protected FileAssert(File actual)
           
 
Method Summary
 FileAssert doesNotExist()
          Verifies that the actual File does not exist.
 FileAssert exists()
          Verifies that the actual File exists, regardless it's a file or directory.
 FileAssert hasContentEqualTo(File expected)
          Verifies that the content of the actual File is equal to the content of the given one.
 FileAssert isAbsolute()
          Verifies that the actual File is an absolute path.
 FileAssert isDirectory()
          Verifies that the actual File is an existing directory.
 FileAssert isFile()
          Verifies that the actual File is an existing file.
 FileAssert isRelative()
          Verifies that the actual File is a relative path.
 
Methods inherited from class org.fest.assertions.api.AbstractAssert
as, as, describedAs, describedAs, descriptionText, doesNotHave, equals, has, hashCode, is, isEqualTo, isIn, isIn, isNot, isNotEqualTo, isNotIn, isNotIn, isNotNull, isNotSameAs, isNull, isSameAs, usingComparator, usingDefaultComparator
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileAssert

protected FileAssert(File actual)
Method Detail

exists

public FileAssert exists()
Verifies that the actual File exists, regardless it's a file or directory.

Returns:
this assertion object.
Throws:
AssertionError - if the actual File is null.
AssertionError - if the actual File does not exist.

doesNotExist

public FileAssert doesNotExist()
Verifies that the actual File does not exist.

Returns:
this assertion object.
Throws:
AssertionError - if the actual File is null.
AssertionError - if the actual File exists.

isFile

public FileAssert isFile()
Verifies that the actual File is an existing file.

Returns:
this assertion object.
Throws:
AssertionError - if the actual File is null.
AssertionError - if the actual File is not an existing file.

isDirectory

public FileAssert isDirectory()
Verifies that the actual File is an existing directory.

Returns:
this assertion object.
Throws:
AssertionError - if the actual File is null.
AssertionError - if the actual File is not an existing file.

isAbsolute

public FileAssert isAbsolute()
Verifies that the actual File is an absolute path.

Returns:
this assertion object.
Throws:
AssertionError - if the actual File is null.
AssertionError - if the actual File is not an absolute path.

isRelative

public FileAssert isRelative()
Verifies that the actual File is a relative path.

Returns:
this assertion object.
Throws:
AssertionError - if the actual File is null.
AssertionError - if the actual File is not a relative path.

hasContentEqualTo

public FileAssert hasContentEqualTo(File expected)
Verifies that the content of the actual File is equal to the content of the given one.

Parameters:
expected - the given File to compare the actual File to.
Returns:
this assertion object.
Throws:
NullPointerException - if the given File is null.
IllegalArgumentException - if the given File is not an existing file.
AssertionError - if the actual File is null.
AssertionError - if the actual File is not an existing file.
org.fest.util.FilesException - if an I/O error occurs.
AssertionError - if the content of the actual File is not equal to the content of the given one.


Copyright © 2007-2012 FEST (Fixtures for Easy Software Testing). All Rights Reserved.