ApplicationInstanceResourceImpl implements ApplicationInstanceResource { public Task uninstall(String org, String vdc, String environmentName, String applicationName, String callback) throws APIException { ClaudiaData claudiaData = new ClaudiaData(org, vdc, environmentName); try { validator.validateUnInstall(vdc, environmentName, applicationName); log.info("Application validated"); } catch (Exception ex) { throw new APIException(ex); } Task task = createTask(MessageFormat.format("Uninstalling application Instance {0} ", applicationName), vdc); applicationInstanceAsyncManager.uninstall(claudiaData, environmentName, applicationName, task, callback); return task; }  Task install(String org, String vdc, String environmentInstance,

    ApplicationReleaseDto applicationReleaseDto, String callback); List<ApplicationInstance> findAll(Integer page, Integer pageSize, String orderBy, String orderType,
            List<Status> status, String vdc, String environmentInstance, String productInstanceName,
            String applicationName); Task uninstall(String org, String vdc, String environmentName, String applicationName, String callback); ApplicationInstance load(String vdc, String enviroment, String name); void setValidator(ApplicationInstanceResourceValidator validator); void setEnvironmentInstanceAsyncManager(EnvironmentInstanceAsyncManager environmentInstanceAsyncManager); void setEnvironmentInstanceManager(EnvironmentInstanceManager environmentInstanceManager); void setTaskManager(TaskManager taskManager); void setApplicationInstanceAsyncManager(ApplicationInstanceAsyncManager applicationInstanceAsyncManager); void setApplicationInstanceManager(ApplicationInstanceManager applicationInstanceManager); void setApplicationReleaseManager(ApplicationReleaseManager applicationReleaseManager);  }
@Test public void testUninstall() throws EntityNotFoundException { EnvironmentInstance env = new EnvironmentInstance(); ApplicationInstance app = new ApplicationInstance(); when(environmentInstanceManager.load(any(String.class), any(String.class))).thenReturn(env); when(applicationInstanceManager.load(any(String.class), any(String.class))).thenReturn(app); Mockito.doNothing() .when(applicationInstanceAsyncManager) .uninstall(any(ClaudiaData.class), any(String.class), any(String.class), any(Task.class), any(String.class)); Task tasks = new Task(); tasks.setStatus(TaskStates.RUNNING); when(taskManager.createTask(any(Task.class))).thenReturn(tasks); task = applicationInstanceResource.uninstall(org, vdc, "env", "APP", callback); assertNotNull(task); assertEquals(task.getStatus(), TaskStates.RUNNING); }