File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed
plugin-maven/src/test/java/com/diffplug/spotless/maven/json Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change 21
21
22
22
public class JsonTest extends MavenIntegrationHarness {
23
23
@ Test
24
- public void testFormatJson_WithSimple_defaultConfig () throws Exception {
24
+ public void testFormatJson_WithSimple_defaultConfig_sortByKeys () throws Exception {
25
25
writePomWithJsonSteps ("<simple/>" );
26
26
27
27
setFile ("json_test.json" ).toResource ("json/sortByKeysBefore.json" );
@@ -30,11 +30,30 @@ public void testFormatJson_WithSimple_defaultConfig() throws Exception {
30
30
}
31
31
32
32
@ Test
33
- public void testFormatJson_WithGson_defaultConfig () throws Exception {
33
+ public void testFormatJson_WithSimple_defaultConfig_nestedObject () throws Exception {
34
+ writePomWithJsonSteps ("<simple/>" );
35
+
36
+ setFile ("json_test.json" ).toResource ("json/nestedObjectBefore.json" );
37
+ mavenRunner ().withArguments ("spotless:apply" ).runNoError ().error ();
38
+ assertFile ("json_test.json" ).sameAsResource ("json/nestedObjectAfter.json" );
39
+ }
40
+
41
+ @ Test
42
+ public void testFormatJson_WithGson_defaultConfig_sortByKeys () throws Exception {
34
43
writePomWithJsonSteps ("<gson/>" );
35
44
36
45
setFile ("json_test.json" ).toResource ("json/sortByKeysBefore.json" );
37
46
mavenRunner ().withArguments ("spotless:apply" ).runNoError ().error ();
38
47
assertFile ("json_test.json" ).sameAsResource ("json/sortByKeysAfterDisabled.json" );
39
48
}
49
+
50
+ @ Test
51
+ public void testFormatJson_WithGson_sortByKeys () throws Exception {
52
+ writePomWithJsonSteps ("<gson><sortByKeys>true</sortByKeys></gson>" );
53
+
54
+ setFile ("json_test.json" ).toResource ("json/sortByKeysBefore.json" );
55
+ mavenRunner ().withArguments ("spotless:apply" ).runNoError ().error ();
56
+ assertFile ("json_test.json" ).sameAsResource ("json/sortByKeysAfter.json" );
57
+ }
58
+
40
59
}
You can’t perform that action at this time.
0 commit comments