Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed support for deserialization from Base64 into a byte array.
- Loading branch information
Ondřej Hrstka
committed
Apr 20, 2022
1 parent
cc1b245
commit 6dea603
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...n-core/src/test/groovy/io/micronaut/jackson/core/tree/JsonNodeTraversingParserTest.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package io.micronaut.jackson.core.tree | ||
|
||
import com.fasterxml.jackson.core.Base64Variant | ||
import com.fasterxml.jackson.core.Base64Variants | ||
import io.micronaut.json.tree.JsonNode | ||
import spock.lang.Specification | ||
|
||
class JsonNodeTraversingParserTest extends Specification { | ||
|
||
def getBinaryValue() { | ||
given: | ||
def jsonNode = JsonNode.createArrayNode([JsonNode.createStringNode(content)]) | ||
def parser = new JsonNodeTraversingParser(jsonNode) | ||
|
||
parser.nextToken() | ||
parser.nextToken() | ||
|
||
def binaryValue = parser.getBinaryValue(Base64Variants.MIME) | ||
|
||
expect: | ||
new String(binaryValue) == expected | ||
|
||
where: | ||
content || expected | ||
"YWJj" || "abc" | ||
} | ||
|
||
} |