-
-
Notifications
You must be signed in to change notification settings - Fork 799
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
bfee8e2
commit e66d2fe
Showing
4 changed files
with
52 additions
and
12 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
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
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
40 changes: 40 additions & 0 deletions
40
src/test/java/com/fasterxml/jackson/core/base64/Base64Padding912Test.java
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,40 @@ | ||
package com.fasterxml.jackson.core.base64; | ||
|
||
import com.fasterxml.jackson.core.*; | ||
|
||
public class Base64Padding912Test | ||
extends com.fasterxml.jackson.core.BaseTest | ||
{ | ||
private final JsonFactory JSON_F = newStreamFactory(); | ||
|
||
public void testPaddingUsingInputStream() throws Exception | ||
{ | ||
_testPadding(MODE_INPUT_STREAM); | ||
_testPadding(MODE_INPUT_STREAM_THROTTLED); | ||
} | ||
|
||
public void testPaddingUsingReader() throws Exception | ||
{ | ||
_testPadding(MODE_READER); | ||
} | ||
|
||
public void testPaddingUsingDataInput() throws Exception | ||
{ | ||
_testPadding(MODE_DATA_INPUT); | ||
} | ||
|
||
private void _testPadding(int mode) throws Exception | ||
{ | ||
Base64Variant b64v = Base64Variants.MIME_NO_LINEFEEDS | ||
.withReadPadding(Base64Variant.PaddingReadBehaviour.PADDING_ALLOWED); | ||
String json = "{\"diff\" : \"1sPEAASBOGM6XGFwYWNoZV9yb290X2Rldlx0bXBcX3N0YXBsZXJcNHEydHJhY3ZcYXZhc3RfZnJlZV9hbnRpdmlydXNfc2V0dXBfb25saW5lLmV4ZS8vYzpcYXBhY2hlX3Jvb3RfZGV2XHN0b3JhZ2VcY1w3XDFcYzcxZmViMTA2NDA5MTE4NzIwOGI4MGNkM2Q0NWE0YThcYXZhc3RfZnJlZV9hbnRpdmlydXNfc2V0dXBfb25saW5lLmV4ZS8FkK0pAKA2kLFgAJsXgyyBZfkKWXg6OZiYBgBYCQCASAAAgAMAAAC4AACABgEAgAoAAABYCACADgAAAJgIAIAQAAAA2AgAgBgAAAAYCWgAAIDJAAAAkHgJAwAqDwCoAAAAqBgDAIwOAAUAAQAAAPAAAIACAUABAIAEAQCABQEIAQAAOCcDAEAhADABAAB4SAMAKFgBAACgigMAqCUAAQAASLADAKgBAADwwAMAaAQAFQA\"}"; | ||
try (JsonParser p = createParser(JSON_F, mode, json)) { | ||
assertToken(JsonToken.START_OBJECT, p.nextToken()); | ||
assertEquals("diff", p.nextFieldName()); | ||
assertToken(JsonToken.VALUE_STRING, p.nextToken()); | ||
byte[] b = p.getBinaryValue(b64v); | ||
assertNotNull(b); | ||
assertToken(JsonToken.END_OBJECT, p.nextToken()); | ||
} | ||
} | ||
} |