@AfterMethod
 public void tearDownTest() throws Throwable {
   if (sourceEnvironment != null) {
     sourceEnvironment.stop();
   }
   if (destinationEnvironment != null) {
     destinationEnvironment.stop();
   }
   apiClientFactory = null;
 }
 @AfterMethod
 public void tearDownTest() throws Throwable {
   if (null != testEnvironment) {
     testEnvironment.stop();
     testEnvironment = null;
   }
 }
    @Test
    public void testSourceEnvironmentStoppedFailure() throws Throwable {
      createTestEnvironment();
      sourceEnvironment.stop();
      sourceEnvironment = null;

      InitializeDeploymentMigrationWorkflowService.State finalState =
          destinationEnvironment.callServiceAndWaitForState(
              InitializeDeploymentMigrationWorkflowFactoryService.SELF_LINK,
              startState,
              InitializeDeploymentMigrationWorkflowService.State.class,
              (state) -> TaskUtils.finalTaskStages.contains(state.taskState.stage));

      assertThat(
          finalState.taskState.stage,
          is(InitializeDeploymentMigrationWorkflowService.TaskState.TaskStage.FAILED));
    }