File tree 3 files changed +28
-29
lines changed
java-snapshot-testing-plugin-jackson
src/main/java/au/com/origin/snapshots/jackson/serializers/v1
3 files changed +28
-29
lines changed Original file line number Diff line number Diff line change @@ -21,10 +21,10 @@ dependencies {
21
21
testImplementation ' org.assertj:assertj-core:3.11.1'
22
22
testImplementation ' org.skyscreamer:jsonassert:1.5.0' // For docs/ reporter example
23
23
24
- testImplementation ' com.fasterxml.jackson.core:jackson-core:2.11.3 '
25
- testImplementation ' com.fasterxml.jackson.core:jackson-databind:2.11.3 '
26
- testRuntimeOnly ' com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.11.3 '
27
- testRuntimeOnly ' com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.11.3 '
24
+ testImplementation ' com.fasterxml.jackson.core:jackson-core:2.16.0 '
25
+ testImplementation ' com.fasterxml.jackson.core:jackson-databind:2.16.0 '
26
+ testRuntimeOnly ' com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.16.0 '
27
+ testRuntimeOnly ' com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.16.0 '
28
28
}
29
29
30
30
test { useJUnitPlatform() }
Original file line number Diff line number Diff line change 8
8
import com .fasterxml .jackson .annotation .JsonAutoDetect ;
9
9
import com .fasterxml .jackson .annotation .JsonInclude ;
10
10
import com .fasterxml .jackson .core .PrettyPrinter ;
11
- import com .fasterxml .jackson .core .util .DefaultIndenter ;
12
- import com .fasterxml .jackson .core .util .DefaultPrettyPrinter ;
13
- import com .fasterxml .jackson .core .util .Separators ;
14
11
import com .fasterxml .jackson .databind .ObjectMapper ;
15
12
import com .fasterxml .jackson .databind .SerializationFeature ;
16
13
import java .util .Arrays ;
17
14
import java .util .List ;
18
15
19
16
public class JacksonSnapshotSerializer implements SnapshotSerializer {
20
17
21
- private final PrettyPrinter pp =
22
- new DefaultPrettyPrinter ("" ) {
23
- {
24
- Indenter lfOnlyIndenter = new DefaultIndenter (" " , "\n " );
25
- this .indentArraysWith (lfOnlyIndenter );
26
- this .indentObjectsWith (lfOnlyIndenter );
27
- }
28
-
29
- // It's a requirement
30
- // @see https://github.com/FasterXML/jackson-databind/issues/2203
31
- public DefaultPrettyPrinter createInstance () {
32
- return new DefaultPrettyPrinter (this );
33
- }
34
-
35
- @ Override
36
- public DefaultPrettyPrinter withSeparators (Separators separators ) {
37
- this ._separators = separators ;
38
- this ._objectFieldValueSeparatorWithSpaces =
39
- separators .getObjectFieldValueSeparator () + " " ;
40
- return this ;
41
- }
42
- };
18
+ private final PrettyPrinter pp = new SnapshotPrettyPrinter ();
43
19
private final ObjectMapper objectMapper =
44
20
new ObjectMapper () {
45
21
{
Original file line number Diff line number Diff line change
1
+ package au .com .origin .snapshots .jackson .serializers .v1 ;
2
+
3
+ import com .fasterxml .jackson .core .util .DefaultIndenter ;
4
+ import com .fasterxml .jackson .core .util .DefaultPrettyPrinter ;
5
+
6
+ class SnapshotPrettyPrinter extends DefaultPrettyPrinter {
7
+
8
+ public SnapshotPrettyPrinter () {
9
+ super ("" );
10
+ Indenter lfOnlyIndenter = new DefaultIndenter (" " , "\n " );
11
+ this .indentArraysWith (lfOnlyIndenter );
12
+ this .indentObjectsWith (lfOnlyIndenter );
13
+
14
+ this ._objectFieldValueSeparatorWithSpaces =
15
+ this ._separators .getObjectFieldValueSeparator () + " " ;
16
+ }
17
+
18
+ // It's a requirement
19
+ // @see https://github.com/FasterXML/jackson-databind/issues/2203
20
+ public DefaultPrettyPrinter createInstance () {
21
+ return new DefaultPrettyPrinter (this );
22
+ }
23
+ }
You can’t perform that action at this time.
0 commit comments