Class FileAnticipator


  • public class FileAnticipator
    extends org.junit.Assert
    File anticipator. Example usage with late initialization:
    Author:
    DJ Gregor
    • Constructor Detail

      • FileAnticipator

        public FileAnticipator()
                        throws IOException

        Constructor for FileAnticipator.

        Throws:
        IOException - if any.
      • FileAnticipator

        public FileAnticipator​(boolean initialize)
                        throws IOException

        Constructor for FileAnticipator.

        Parameters:
        initialize - a boolean.
        Throws:
        IOException - if any.
    • Method Detail

      • tearDown

        public void tearDown()

        tearDown

      • generateRandomHexString

        protected static String generateRandomHexString​(int length)

        generateRandomHexString

        Parameters:
        length - a int.
        Returns:
        a String object.
      • getTempDir

        public File getTempDir()

        getTempDir

        Returns:
        a File object.
      • expecting

        public File expecting​(String name)

        expecting

        Parameters:
        name - a String object.
        Returns:
        a File object.
      • expecting

        public File expecting​(File parent,
                              String name)

        expecting

        Parameters:
        parent - a File object.
        name - a String object.
        Returns:
        a File object.
      • expectingFileWithPrefix

        public void expectingFileWithPrefix​(File parent,
                                            String prefix,
                                            String... suffixesToExclude)
      • deleteExpected

        public void deleteExpected()
        Delete expected files, throwing an AssertionFailedError if any of the expected files don't exist.
      • deleteExpected

        public void deleteExpected​(boolean ignoreNonExistantFiles)
        Delete expected files, throwing an AssertionFailedError if any of the expected files don't exist.
        Parameters:
        ignoreNonExistantFiles - if true, non-existant files will be ignored and will not throw an AssertionFailedError
        Throws:
        junit.framework.AssertionFailedError - if ignoreNonExistantFiles is false and an expected file does not exist, or if a file cannot be deleted
      • isInitialized

        public boolean isInitialized()

        isInitialized

        Returns:
        a boolean.
      • foundExpected

        public boolean foundExpected()