RuntimeCleaner { public void cleanUp(KubernetesNamespace namespace, String workspaceId) throws InfrastructureException { namespace.cleanUp(); if (cleanupCheNamespace) { cheNamespace.cleanUp(workspaceId); } } @Inject  RuntimeCleaner(
      @Named("che.infra.kubernetes.server_strategy") String exposureStrategy,
      @Named("che.infra.kubernetes.singlehost.workspace.exposure") String singleHostStrategy,
      CheNamespace cheNamespace); void cleanUp(KubernetesNamespace namespace, String workspaceId);  }
@Test public void shouldCleanupEverythingIfSinglehostGateway() throws InfrastructureException { RuntimeCleaner runtimeCleaner = new RuntimeCleaner(SINGLE_HOST_STRATEGY, GATEWAY.getConfigValue(), cheNamespace); runtimeCleaner.cleanUp(kubeNamespace, WS_ID); verify(cheNamespace).cleanUp(WS_ID); verify(kubeNamespace).cleanUp(); }
@Test(dataProvider = "notSinglehostGateway") public void shouldNotCleanupCheNamespaceIfNotSinglehostGateway( String serverStrategy, String singleHostStrategy) throws InfrastructureException { RuntimeCleaner runtimeCleaner = new RuntimeCleaner(serverStrategy, singleHostStrategy, cheNamespace); runtimeCleaner.cleanUp(kubeNamespace, WS_ID); verify(kubeNamespace).cleanUp(); verify(cheNamespace, never()).cleanUp(any()); }