CheInstallationLocation { public String getInstallationLocationNamespace() throws InfrastructureException { if (kubernetesNamespace == null && podNamespace == null) { throw new InfrastructureException( "Neither KUBERNETES_NAMESPACE nor POD_NAMESPACE is defined. Unable to determine Che installation location"); } return kubernetesNamespace == null ? podNamespace : kubernetesNamespace; }  String getInstallationLocationNamespace();  }
@Test public void returnKubernetesNamespaceWhenBothSet() throws InfrastructureException { CheInstallationLocation cheInstallationLocation = new CheInstallationLocation(); cheInstallationLocation.kubernetesNamespace = "kube"; cheInstallationLocation.podNamespace = "pod"; assertEquals(cheInstallationLocation.getInstallationLocationNamespace(), "kube"); }
@Test public void returnKubernetesNamespaceWhenItsOnlySet() throws InfrastructureException { CheInstallationLocation cheInstallationLocation = new CheInstallationLocation(); cheInstallationLocation.kubernetesNamespace = "kube"; cheInstallationLocation.podNamespace = null; assertEquals(cheInstallationLocation.getInstallationLocationNamespace(), "kube"); }
@Test public void returnPodNamespaceWhenKubernetesNamespaceNotSet() throws InfrastructureException { CheInstallationLocation cheInstallationLocation = new CheInstallationLocation(); cheInstallationLocation.kubernetesNamespace = null; cheInstallationLocation.podNamespace = "pod"; assertEquals(cheInstallationLocation.getInstallationLocationNamespace(), "pod"); }
@Test(expectedExceptions = InfrastructureException.class) public void throwExceptionWhenNoneSet() throws InfrastructureException { CheInstallationLocation cheInstallationLocation = new CheInstallationLocation(); cheInstallationLocation.kubernetesNamespace = null; cheInstallationLocation.podNamespace = null; cheInstallationLocation.getInstallationLocationNamespace(); }