40
40
*/
41
41
public class JarCommandIT {
42
42
43
+ private static final boolean java9OrLater ;
44
+
45
+ static {
46
+ boolean loaded = false ;
47
+ try {
48
+ Class .forName ("java.security.cert.URICertStoreParameters" );
49
+ loaded = true ;
50
+ }
51
+ catch (Exception ex ) {
52
+ // Continue
53
+ }
54
+ finally {
55
+ java9OrLater = loaded ;
56
+ }
57
+ }
58
+
43
59
private final CommandLineInvoker cli = new CommandLineInvoker (
44
60
new File ("src/it/resources/jar-command" ));
45
61
@@ -67,19 +83,25 @@ public void jarCreationWithGrabResolver() throws Exception {
67
83
Invocation invocation = this .cli .invoke ("run" , jar .getAbsolutePath (),
68
84
"bad.groovy" );
69
85
invocation .await ();
70
- assertThat (invocation .getErrorOutput (), equalTo ("" ));
86
+ if (!java9OrLater ) {
87
+ assertThat (invocation .getErrorOutput (), equalTo ("" ));
88
+ }
71
89
invocation = this .cli .invoke ("jar" , jar .getAbsolutePath (), "bad.groovy" );
72
90
invocation .await ();
73
- assertEquals (invocation .getErrorOutput (), 0 ,
74
- invocation .getErrorOutput ().length ());
91
+ if (!java9OrLater ) {
92
+ assertEquals (invocation .getErrorOutput (), 0 ,
93
+ invocation .getErrorOutput ().length ());
94
+ }
75
95
assertTrue (jar .exists ());
76
96
77
97
Process process = new JavaExecutable ()
78
98
.processBuilder ("-jar" , jar .getAbsolutePath ()).start ();
79
99
invocation = new Invocation (process );
80
100
invocation .await ();
81
101
82
- assertThat (invocation .getErrorOutput (), equalTo ("" ));
102
+ if (!java9OrLater ) {
103
+ assertThat (invocation .getErrorOutput (), equalTo ("" ));
104
+ }
83
105
}
84
106
85
107
@ Test
@@ -88,16 +110,20 @@ public void jarCreation() throws Exception {
88
110
Invocation invocation = this .cli .invoke ("jar" , jar .getAbsolutePath (),
89
111
"jar.groovy" );
90
112
invocation .await ();
91
- assertEquals (invocation .getErrorOutput (), 0 ,
92
- invocation .getErrorOutput ().length ());
113
+ if (!java9OrLater ) {
114
+ assertEquals (invocation .getErrorOutput (), 0 ,
115
+ invocation .getErrorOutput ().length ());
116
+ }
93
117
assertTrue (jar .exists ());
94
118
95
119
Process process = new JavaExecutable ()
96
120
.processBuilder ("-jar" , jar .getAbsolutePath ()).start ();
97
121
invocation = new Invocation (process );
98
122
invocation .await ();
99
123
100
- assertThat (invocation .getErrorOutput (), equalTo ("" ));
124
+ if (!java9OrLater ) {
125
+ assertThat (invocation .getErrorOutput (), equalTo ("" ));
126
+ }
101
127
assertThat (invocation .getStandardOutput (), containsString ("Hello World!" ));
102
128
assertThat (invocation .getStandardOutput (),
103
129
containsString ("/BOOT-INF/classes!/public/public.txt" ));
@@ -118,16 +144,20 @@ public void jarCreationWithIncludes() throws Exception {
118
144
Invocation invocation = this .cli .invoke ("jar" , jar .getAbsolutePath (), "--include" ,
119
145
"-public/**,-resources/**" , "jar.groovy" );
120
146
invocation .await ();
121
- assertEquals (invocation .getErrorOutput (), 0 ,
122
- invocation .getErrorOutput ().length ());
147
+ if (!java9OrLater ) {
148
+ assertEquals (invocation .getErrorOutput (), 0 ,
149
+ invocation .getErrorOutput ().length ());
150
+ }
123
151
assertTrue (jar .exists ());
124
152
125
153
Process process = new JavaExecutable ()
126
154
.processBuilder ("-jar" , jar .getAbsolutePath ()).start ();
127
155
invocation = new Invocation (process );
128
156
invocation .await ();
129
157
130
- assertThat (invocation .getErrorOutput (), equalTo ("" ));
158
+ if (!java9OrLater ) {
159
+ assertThat (invocation .getErrorOutput (), equalTo ("" ));
160
+ }
131
161
assertThat (invocation .getStandardOutput (), containsString ("Hello World!" ));
132
162
assertThat (invocation .getStandardOutput (),
133
163
not (containsString ("/public/public.txt" )));
0 commit comments