@Test public void shouldCreateDomain() throws OpenShiftException { // pre-condition // cannot create domain if there's already one DomainTestUtils.destroyAllDomains(user); // operation String id = DomainTestUtils.createRandomName(); IDomain domain = user.createDomain(id); // verification assertThat(domain.getId()).isEqualTo(id); }
@Test public void shouldReturnThatHasntNamedDomain() throws OpenShiftException { // precondition // operation Boolean hasDomain = user.hasDomain(DomainTestUtils.createRandomName()); // verification assertFalse(hasDomain); }
@Test public void shouldReturnNoDomains() throws OpenShiftException { // precondition DomainTestUtils.destroyAllDomains(user); // operation List<IDomain> domains = user.getDomains(); // verification assertThat(domains).isEmpty(); }
@Test public void shouldReturnDomains() throws OpenShiftException { // precondition DomainTestUtils.ensureHasDomain(user); // operation List<IDomain> domains = user.getDomains(); // verification assertThat(domains).isNotEmpty(); }
@Test public void shouldReturnId() throws OpenShiftException { // precondition DomainTestUtils.ensureHasDomain(user); // operation String id = user.getId(); // verification assertThat(id).isNotEmpty(); }
@Test public void shouldReturnThatHasNamedDomain() throws OpenShiftException { // precondition IDomain domain = DomainTestUtils.ensureHasDomain(user); // operation Boolean hasDomain = user.hasDomain(domain.getId()); // verification assertTrue(hasDomain); }
@Test public void shouldReturnThatHasNoDomain() throws OpenShiftException { // precondition DomainTestUtils.destroyAllDomains(user); // operation Boolean hasDomain = user.hasDomain(); // verification assertFalse(hasDomain); }
@Test public void shouldReturnDomainByName() throws OpenShiftException { // pre-condition IDomain domain = DomainTestUtils.ensureHasDomain(user); // operation IDomain domainByNamespace = user.getDomain(domain.getId()); // verification assertThat(domainByNamespace.getId()).isEqualTo(domain.getId()); }
@Test public void shouldNoDefaultDomainAfterRefresh() throws OpenShiftException, FileNotFoundException, IOException { // precondition IDomain domain = DomainTestUtils.ensureHasDomain(user); assertNotNull(domain); IUser otherUser = new TestConnectionBuilder() .defaultCredentials() .disableSSLCertificateChecks() .create() .getUser(); DomainTestUtils.destroyAllDomains(otherUser); assertNull(otherUser.getDefaultDomain()); // operation user.refresh(); // verification assertNull(user.getDefaultDomain()); }
@Test public void shouldGetDefaultDomain() throws OpenShiftException { // precondition DomainTestUtils.ensureHasDomain(user); // operation IDomain domain = user.getDefaultDomain(); // verification assertNotNull(domain); assertNotNull(domain.getId()); assertTrue(domain.getId().length() > 0); assertNotNull(domain.getSuffix()); assertTrue(domain.getSuffix().length() > 0); }