File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed
main/java/io/kubernetes/client
test/java/io/kubernetes/client Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change 39
39
import java .util .HashMap ;
40
40
import java .util .List ;
41
41
import java .util .Map ;
42
+ import java .util .Objects ;
42
43
import java .util .Optional ;
43
44
import java .util .concurrent .CompletableFuture ;
44
45
import java .util .concurrent .CountDownLatch ;
@@ -359,9 +360,9 @@ public final class ExecutionBuilder {
359
360
private Consumer <Throwable > onUnhandledError ;
360
361
361
362
private ExecutionBuilder (String namespace , String name , String [] command ) {
362
- this .namespace = namespace ;
363
- this .name = name ;
364
- this .command = command ;
363
+ this .namespace = Objects . requireNonNull ( namespace , "namespace" ) ;
364
+ this .name = Objects . requireNonNull ( name , "name" ) ;
365
+ this .command = Objects . requireNonNull ( command , "command" ) ;
365
366
this .stdin = true ;
366
367
this .stdout = true ;
367
368
this .stderr = true ;
Original file line number Diff line number Diff line change 19
19
import static com .github .tomakehurst .wiremock .client .WireMock .urlPathEqualTo ;
20
20
import static com .github .tomakehurst .wiremock .core .WireMockConfiguration .options ;
21
21
import static org .junit .Assert .assertEquals ;
22
+ import static org .junit .Assert .assertThrows ;
22
23
import static org .mockito .ArgumentMatchers .any ;
23
24
import static org .mockito .Mockito .mock ;
24
25
import static org .mockito .Mockito .times ;
@@ -281,4 +282,18 @@ public void testNonZeroBadIntExit() {
281
282
int exitCode = Exec .parseExitCode (client , inputStream );
282
283
assertEquals (-1 , exitCode );
283
284
}
285
+
286
+ @ Test
287
+ public void testExecutionBuilderNull () {
288
+ Exec exec = new Exec (null );
289
+ assertThrows (NullPointerException .class , () -> {
290
+ exec .newExecutionBuilder (null , null , null );
291
+ });
292
+ assertThrows (NullPointerException .class , () -> {
293
+ exec .newExecutionBuilder ("" , null , null );
294
+ });
295
+ assertThrows (NullPointerException .class , () -> {
296
+ exec .newExecutionBuilder ("" , "" , null );
297
+ });
298
+ }
284
299
}
You can’t perform that action at this time.
0 commit comments