org.fest.assertions.internal
Class Files

java.lang.Object
  extended by org.fest.assertions.internal.Files

public class Files
extends Object

Reusable assertions for Files.

Author:
David DIDIER, Yvonne Wang, Alex Ruiz

Method Summary
 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 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

instance

public static Files instance()
Returns the singleton instance of this class.

Returns:
the singleton instance of this class.

assertEqualContent

public void assertEqualContent(AssertionInfo info,
                               File actual,
                               File expected)
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 - if expected is null.
IllegalArgumentException - if expected is not an existing file.
AssertionError - if actual is null.
AssertionError - if actual 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.

assertIsFile

public void assertIsFile(AssertionInfo info,
                         File actual)
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 is null.
AssertionError - if the given file is not an existing file.

assertIsDirectory

public void assertIsDirectory(AssertionInfo info,
                              File actual)
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 is null.
AssertionError - if the given file is not an existing directory.

assertIsAbsolute

public void assertIsAbsolute(AssertionInfo info,
                             File actual)
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 is null.
AssertionError - if the given file is not an absolute path.

assertIsRelative

public void assertIsRelative(AssertionInfo info,
                             File actual)
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 is null.
AssertionError - if the given file is not a relative path.

assertExists

public void assertExists(AssertionInfo info,
                         File actual)
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 is null.
AssertionError - if the given file does not exist.

assertDoesNotExist

public void assertDoesNotExist(AssertionInfo info,
                               File actual)
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 is null.
AssertionError - if the given file exists.


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