1 package club.wpia.gigi.pages.account;
3 import static org.junit.Assert.*;
5 import java.io.IOException;
6 import java.net.URLEncoder;
10 import club.wpia.gigi.dbObjects.Domain;
11 import club.wpia.gigi.pages.account.domain.DomainOverview;
12 import club.wpia.gigi.testUtils.ClientTest;
14 public class TestDomain extends ClientTest {
16 public TestDomain() throws IOException {}
19 public void testAdd() throws IOException {
20 assertNull(addDomain(cookie, uniq + ".de"));
21 assertNotNull(addDomain(cookie, uniq + ".de"));
25 public void testInvalid() throws IOException {
26 assertNotNull(addDomain(cookie, uniq + ".invalid"));
30 public void testHighFinancialValue() throws IOException {
31 assertNotNull(addDomain(cookie, "google.com"));
35 public void testDelete() throws IOException {
36 String domain = uniq + ".de";
37 assertNull(addDomain(cookie, domain));
38 Domain d0 = Domain.searchDomain(domain);
39 assertNull(executeBasicWebInteraction(cookie, DomainOverview.PATH, "delete=" + d0.getId(), 0));
41 assertNotNull(executeBasicWebInteraction(cookie, DomainOverview.PATH, "delete=" + d0.getId(), 0));
43 assertNull(addDomain(cookie, domain));
44 Domain d1 = Domain.searchDomain(domain);
45 assertNotEquals(d0.getId(), d1.getId());
46 assertNull(executeBasicWebInteraction(cookie, DomainOverview.PATH, "delete=" + d1.getId(), 0));
49 public static String addDomain(String session, String domain) throws IOException {
50 return executeBasicWebInteraction(session, DomainOverview.PATH, "adddomain&newdomain=" + URLEncoder.encode(domain, "UTF-8"), 1);