Annotation Type Encoding
-
@Target({FIELD,PARAMETER,METHOD,CONSTRUCTOR,TYPE,ANNOTATION_TYPE}) @Retention(RUNTIME) @Inherited public @interface Encoding
Encoding
can be used in combination withTestResource
to specify a specific encoding or charset to use.The encoding to use is looked up in the following order:
- An
Encoding
annotation on the field or parameter itself - For parameters, an
Encoding
annotation on the constructor or method - An
Encoding
annotation on the class defining the field, constructor or method - An
Encoding
annotation 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
Launcher
API, build tools (e.g., Gradle and Maven), a JVM system property, or the JUnit Platform configuration file (i.e., a file namedjunit-platform.properties
in 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:
DEFAULT
forCharset.defaultCharset()
SYSTEM
for system propertyfile.encoding
NATIVE
for system propertynative.encoding
(since Java 17)
UTF-8
.
- Author:
- Rob Spoor
- Since:
- 2.0
- An
-
-
Field Summary
Fields Modifier and Type Fields Description static String
DEFAULT
A marker that indicates the default charset should be used.static String
DEFAULT_ENCODING_PROPERTY_NAME
The property that can be used to define the default encoding.static String
NATIVE
A marker that indicates the value from thenative.encoding
system property should be used.static String
SYSTEM
A marker that indicates the value from thefile.encoding
system 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.encoding
system property should be used.
-
-
-
NATIVE
static final String NATIVE
A marker that indicates the value from thenative.encoding
system 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.
-
-