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 FiletempDirectoryorg.junit.rules.TemporaryFoldertestFolder
-
Constructor Summary
Constructors Constructor Description AbstractAny23TestBase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected FilecopyResourceToTempFile(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 DocumentSourcegetDocumentSourceFromResource(String resourceLocation)protected DocumentSourcegetDocumentSourceFromResource(String resourceLocation, String baseUri)voidsetUp()
-
-
-
Field Detail
-
testFolder
public org.junit.rules.TemporaryFolder testFolder
-
tempDirectory
protected File tempDirectory
-
-
Method Detail
-
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 aFileOutputStreamIOException- if there is an issue with the input
-
-