org.opennms.test
Class FileAnticipator

java.lang.Object
  extended by junit.framework.Assert
      extended by org.opennms.test.FileAnticipator

public class FileAnticipator
extends junit.framework.Assert

File anticipator. Example usage with late initialization:

 private FileAnticipator m_fileAnticipator;

Author:
DJ Gregor

Constructor Summary
FileAnticipator()
           
FileAnticipator(boolean initialize)
           
 
Method Summary
 void deleteExpected()
          Delete expected files, throwing an AssertionFailedError if any of the expected files don't exist.
 void deleteExpected(boolean ignoreNonExistantFiles)
          Delete expected files, throwing an AssertionFailedError if any of the expected files don't exist.
 File expecting(File parent, String name)
           
 File expecting(String name)
           
protected  void finalize()
           
protected static String generateRandomHexString(int length)
           
 File getTempDir()
           
 void initialize()
           
 boolean isInitialized()
           
 void tearDown()
           
 File tempDir(File parent, String name)
           
 File tempDir(String name)
           
 File tempFile(File parent, String name)
           
 File tempFile(File parent, String name, String contents)
           
 File tempFile(String name)
           
 File tempFile(String name, String contents)
           
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileAnticipator

public FileAnticipator()
                throws IOException
Throws:
IOException

FileAnticipator

public FileAnticipator(boolean initialize)
                throws IOException
Throws:
IOException
Method Detail

finalize

protected void finalize()
Overrides:
finalize in class Object

tearDown

public void tearDown()

initialize

public void initialize()
                throws IOException
Throws:
IOException

generateRandomHexString

protected static String generateRandomHexString(int length)

getTempDir

public File getTempDir()

tempFile

public File tempFile(String name)
              throws IOException
Throws:
IOException

tempFile

public File tempFile(File parent,
                     String name)
              throws IOException
Throws:
IOException

tempFile

public File tempFile(String name,
                     String contents)
              throws IOException
Throws:
IOException

tempFile

public File tempFile(File parent,
                     String name,
                     String contents)
              throws IOException
Throws:
IOException

tempDir

public File tempDir(String name)
             throws IOException
Throws:
IOException

tempDir

public File tempDir(File parent,
                    String name)
             throws IOException
Throws:
IOException

expecting

public File expecting(String name)

expecting

public File expecting(File parent,
                      String name)

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()


Copyright © 2008. All Rights Reserved.