OpenShiftProject extends KubernetesNamespace { void delete() throws InfrastructureException { String workspaceId = getWorkspaceId(); String projectName = getName(); OpenShiftClient osClient = clientFactory.createOC(workspaceId); try { delete(projectName, osClient); } catch (KubernetesClientException e) { if (e.getCode() == 403) { throw new InfrastructureException( format( "Could not access the project %s when deleting it for workspace %s", projectName, workspaceId), e); } throw new KubernetesInfrastructureException(e); } } @VisibleForTesting  OpenShiftProject(
      OpenShiftClientFactory clientFactory,
      String workspaceId,
      String name,
      KubernetesDeployments deployments,
      KubernetesServices services,
      OpenShiftRoutes routes,
      KubernetesPersistentVolumeClaims pvcs,
      KubernetesIngresses ingresses,
      KubernetesSecrets secrets,
      KubernetesConfigsMaps configMaps);  OpenShiftProject(
      OpenShiftClientFactory clientFactory, Executor executor, String name, String workspaceId); OpenShiftRoutes routes(); void cleanUp();  }
@Test public void testDeletesExistingProject() throws Exception { OpenShiftProject project = new OpenShiftProject(clientFactory, executor, PROJECT_NAME, WORKSPACE_ID); Resource resource = prepareProjectResource(PROJECT_NAME); project.delete(); verify(resource).delete(); }
@Test public void testDoesntFailIfDeletedProjectIsBeingDeleted() throws Exception { OpenShiftProject project = new OpenShiftProject(clientFactory, executor, PROJECT_NAME, WORKSPACE_ID); Resource resource = prepareProjectResource(PROJECT_NAME); when(resource.delete()).thenThrow(new KubernetesClientException("err", 409, null)); project.delete(); verify(resource).delete(); }