public class FileContentAnnotationHandler extends TestListener
FileContent annotation.| Constructor and Description |
|---|
FileContentAnnotationHandler(FileContentReader fileContentReader) |
| Modifier and Type | Method and Description |
|---|---|
void |
beforeTestSetUp(Object testObject,
Method testMethod)
All fields that have an
FileContent annotation will be handled before the setup of the test. |
protected String |
determineEncoding(FileContent fileContentAnnotation) |
protected String |
determineFileName(FileContent fileContentAnnotation) |
protected void |
readFileContentForField(Object testObject,
Field field)
Does the actual content reading and injection for the given field.
|
afterCreateTestObject, afterTestMethod, afterTestTearDown, beforeTestClass, beforeTestMethod, shouldInvokeTestMethodpublic FileContentAnnotationHandler(FileContentReader fileContentReader)
fileContentReader - The content reader implementation, not nullpublic void beforeTestSetUp(Object testObject, Method testMethod)
FileContent annotation will be handled before the setup of the test.
This will convert the content of the requested file to the target type of the field and inject the
result into the field.beforeTestSetUp in class TestListenertestObject - The test instance, not nulltestMethod - The test method, not nullprotected void readFileContentForField(Object testObject, Field field)
testObject - The test instance, not nullfield - The field with the FileContent annotation, not nullprotected String determineEncoding(FileContent fileContentAnnotation)
fileContentAnnotation - The annotation, not nullprotected String determineFileName(FileContent fileContentAnnotation)
fileContentAnnotation - The annotation, not nullCopyright © 2017. All rights reserved.