@Test
public void nonZeroExitCode() throws Exception {

  when(podNameFactory.newName(any(LanderConfiguration.class))).thenReturn("pod-name");
  when(podResource.watch(podWatcherCaptor.capture())).thenReturn(watch);
  when(client.pods()).thenReturn(mixedOperation);
  when(mixedOperation.withName(anyString())).thenReturn(podResource);
  Pod pod = new Pod();
  when(podResource.get()).thenReturn(pod);
  KubernetesLander.Factory factory = new KubernetesLander.Factory(argsFactory, podFactory, podNameFactory, client);
  LanderConfiguration config = new LanderConfiguration("road", "topic", ImmutableMap.of(), "s3Prefix", false,
      "partitionColumnValue", false);
  when(argsFactory.newInstance(config)).thenReturn(ARGS);
  when(podFactory.newInstance(config, ARGS)).thenReturn(pod);
  Lander lander = factory.newInstance(config);
  CompletableFuture<LanderConfiguration> run = lander.run();
  verify(podResource).delete();
  verify(mixedOperation).create(pod);
  pod.setStatus(terminatedPostStatus(1));
  podWatcherCaptor.getValue().eventReceived(null, pod);
  assertThat(run.isCompletedExceptionally(), is(true));
}