Annotation Type Encoding
-
@Target({FIELD,PARAMETER,METHOD,CONSTRUCTOR,TYPE,ANNOTATION_TYPE}) @Retention(RUNTIME) @Inherited public @interface Encoding
Encodingcan be used in combination withTestResourceto specify a specific encoding or charset to use.The encoding to use is looked up in the following order:
- An
Encodingannotation on the field or parameter itself - For parameters, an
Encodingannotation on the constructor or method - An
Encodingannotation on the class defining the field, constructor or method - An
Encodingannotation on any declaring class - The default encoding that is defined via the "com.github.robtimus.junit.support.extension.testresource.encoding" configuration parameter, which can be
supplied via the JUnit
LauncherAPI, build tools (e.g., Gradle and Maven), a JVM system property, or the JUnit Platform configuration file (i.e., a file namedjunit-platform.propertiesin the root of the class path). Consult the JUnit User Guide for further information.This configuration parameter can take a literal value, or one of the following pre-defined values:
DEFAULTforCharset.defaultCharset()SYSTEMfor system propertyfile.encodingNATIVEfor system propertynative.encoding(since Java 17)
UTF-8.
- Author:
- Rob Spoor
- Since:
- 2.0
- An
-
-
Field Summary
Fields Modifier and Type Fields Description static StringDEFAULTA marker that indicates the default charset should be used.static StringDEFAULT_ENCODING_PROPERTY_NAMEThe property that can be used to define the default encoding.static StringNATIVEA marker that indicates the value from thenative.encodingsystem property should be used.static StringSYSTEMA marker that indicates the value from thefile.encodingsystem property should be used.
-
-
-
Field Detail
-
DEFAULT
static final String DEFAULT
A marker that indicates the default charset should be used.
-
-
-
SYSTEM
static final String SYSTEM
A marker that indicates the value from thefile.encodingsystem property should be used.
-
-
-
NATIVE
static final String NATIVE
A marker that indicates the value from thenative.encodingsystem property should be used.
-
-
-
DEFAULT_ENCODING_PROPERTY_NAME
static final String DEFAULT_ENCODING_PROPERTY_NAME
The property that can be used to define the default encoding.
-
-
Element Detail
-
value
String value
The encoding to use.
-
-