Package org.apache.any23

## Class AbstractAny23TestBase

- java.lang.Object
- - org.apache.any23.AbstractAny23TestBase

- Direct Known Subclasses:
    `AbstractExtractorTestCase`, `Any23OnlineTestBase`, `DomUtilsTest`, `EncodingTest`, `SingleDocumentExtractionTest`

      public class AbstractAny23TestBase
      extends Object

  This file encapsulates access to test resource files using temporary files that are automatically cleaned up by JUnit after each test.
  Author:
    Peter Ansell p_ansell@yahoo.com

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected File` | `tempDirectory` |
    `org.junit.rules.TemporaryFolder` | `testFolder` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `AbstractAny23TestBase()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected File` | `copyResourceToTempFile​(String resourceLocation)` | Copies a resource to a temporary directory and returns a file handle that can be used to access the resource as a file from the temp directory.
    `protected DocumentSource` | `getDocumentSourceFromResource​(String resourceLocation)` |
    `protected DocumentSource` | `getDocumentSourceFromResource​(String resourceLocation, String baseUri)` |
    `void` | `setUp()` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### testFolder

          public org.junit.rules.TemporaryFolder testFolder

    - #### tempDirectory

          protected File tempDirectory

  - ### Constructor Detail

    - #### AbstractAny23TestBase

          public AbstractAny23TestBase()

  - ### Method Detail

    - #### setUp

          public void setUp()
                     throws Exception

      Throws:
        `Exception`

    - #### getDocumentSourceFromResource

          protected DocumentSource getDocumentSourceFromResource​(String resourceLocation)
                                                          throws IOException

      Throws:
        `IOException`

    - #### getDocumentSourceFromResource

          protected DocumentSource getDocumentSourceFromResource​(String resourceLocation,
                                                                 String baseUri)
                                                          throws IOException

      Throws:
        `IOException`

    - #### copyResourceToTempFile

          protected File copyResourceToTempFile​(String resourceLocation)
                                         throws FileNotFoundException,
                                                IOException

      Copies a resource to a temporary directory and returns a file handle that can be used to access the resource as a file from the temp directory.
      Parameters:
        `resourceLocation` - The absolute location of the resource in the classpath, which can be used with this.getClass().getResourceAsStream.
      Returns:
        temporary `File`
      Throws:
        `FileNotFoundException` - if the temp file location cannot be converted to a `FileOutputStream`
        `IOException` - if there is an issue with the input