This project provides a collection of JUnit Jupiter converters for parameterized classes and tests.
Annotation | Description |
---|---|
@Base64 |
Decodes Base64 encoded String instances into byte[] instances |
@Hex |
Decodes hexadecimal String instances into byte[] instances |
JUnit Converters is based on JUnit Jupiter 5 and requires Java 8 or higher.
<dependency>
<groupId>io.github.scordio</groupId>
<artifactId>junit-converters</artifactId>
<version>${junit-converters.version}</version>
<scope>test</scope>
</dependency>
testImplementation("io.github.scordio:junit-converters:${junitConvertersVersion}")
@Base64
decodes Base64 encoded String
instances into byte[]
instances.
The annotation's encoding
attribute configures the desired encoding scheme, following RFC 4648 and RFC 2045:
BASIC
: for the Basic encoding scheme (default)URL
: for the URL and Filename Safe encoding schemeMIME
: for the MIME encoding scheme
The following source types and target declarations are supported.
Source Type | Target Declaration | Example |
---|---|---|
String |
@Base64 byte[] bytes |
"Pz8/" → new byte[] { 63, 63, 63 } |
String |
@Base64(encoding = URL) byte[] bytes |
"Pz8_" → new byte[] { 63, 63, 63 } |
String |
@Base64(encoding = MIME) byte[] bytes |
"Pz\r\n8/" → new byte[] { 63, 63, 63 } |
@Hex
decodes hexadecimal String
instances into byte[]
instances.
The following source types and target declarations are supported.
Source Type | Target Declaration | Example |
---|---|---|
String |
@Hex byte[] bytes |
"0A1B2C" → new byte[] { 0x0A, 0x1B, 0x2C } |
JUnit Converters is released under version 2.0 of the Apache License.