ProbeGenerator { public static io.fabric8.kubernetes.api.model.Probe execProbe(Probe probeConfig, List<String> command) { if (command == null || command.isEmpty()) { throw new IllegalArgumentException(); } io.fabric8.kubernetes.api.model.Probe probe = defaultBuilder(probeConfig) .withNewExec() .withCommand(command) .endExec() .build(); return probe; } private  ProbeGenerator(); static ProbeBuilder defaultBuilder(Probe probeConfig); static io.fabric8.kubernetes.api.model.Probe httpProbe(Probe probeConfig, String path, String port); static io.fabric8.kubernetes.api.model.Probe execProbe(Probe probeConfig, List<String> command); static final io.strimzi.api.kafka.model.Probe DEFAULT_TLS_SIDECAR_PROBE; }
@Test public void testExecProbe() { Probe probe = ProbeGenerator.execProbe(DEFAULT_CONFIG, Arrays.asList("command1", "command2")); assertThat(probe, is(new ProbeBuilder() .withNewExec() .addToCommand("command1", "command2") .endExec() .withInitialDelaySeconds(1) .withTimeoutSeconds(2) .withPeriodSeconds(3) .withSuccessThreshold(4) .withFailureThreshold(5) .build() )); }
@Test public void testExecProbeMissingCommandsThrows() { assertThrows(IllegalArgumentException.class, () -> ProbeGenerator.execProbe(DEFAULT_CONFIG, null)); assertThrows(IllegalArgumentException.class, () -> ProbeGenerator.execProbe(DEFAULT_CONFIG, Collections.emptyList())); }