@Target(value=FIELD) @Retention(value=RUNTIME) public @interface FileContent
public class MyTestClass extends UnitilsJUnit4 {
' @FileContent
private String field1;
' @FileContent("/someFile.properties")
private Properties field2;
...
}
In this example the content of 'org/mypackage/MyTestClass.txt" will be injected into field1 and the properties loaded from
'someFile.properties' will be injected into field2.
The encoding of the file can be passed as an argument. By default ISO-8859-1 is used. The default can be set by
overriding the IOModule.encoding.default property.
public abstract String value
public abstract String encoding
Charset
Description
US-ASCII Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the Unicode character set
ISO-8859-1 ISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1
UTF-8 Eight-bit UCS Transformation Format
UTF-16BE Sixteen-bit UCS Transformation Format, big-endian byte order
UTF-16LE Sixteen-bit UCS Transformation Format, little-endian byte order
UTF-16 Sixteen-bit UCS Transformation Format, byte order identified by an optional byte-order mark
Copyright © 2017. All rights reserved.