コード例 #1
0
  @Test(dependsOnMethods = "testCreateEmail")
  public void testAliases() {
    assertTrue(client.listAliases(testDomain).isEmpty());

    EmailAlias alias = client.createAlias("test2@" + testDomain, "test@" + testDomain);
    assertEquals(alias.getAlias(), "test2@" + testDomain);
    assertEquals(alias.getForwardTo(), "test@" + testDomain);

    EmailAlias aliasFromList = Iterables.getOnlyElement(client.listAliases(testDomain));
    assertEquals(aliasFromList, alias);

    EmailOverview overview = client.getEmailOverview();
    assertTrue(overview.getSummary().getAliases() == 1);

    alias = client.editAlias("test2@" + testDomain, "test1@" + testDomain);
    overview = client.getEmailOverview();
    assertTrue(overview.getSummary().getAliases() == 1);

    aliasFromList = Iterables.getOnlyElement(client.listAliases(testDomain));
    assertEquals(aliasFromList, alias);

    client.delete("test2@" + testDomain);
    overview = client.getEmailOverview();
    assertTrue(overview.getSummary().getAliases() == 0);
  }
コード例 #2
0
  @Test(dependsOnMethods = "testCreateEmail")
  public void testOverview() throws Exception {
    EmailOverview overview = client.getEmailOverview();
    assertNotNull(overview.getSummary());
    assertTrue(overview.getSummary().getAccounts() > 0);
    assertTrue(overview.getSummary().getAliases() > -1);
    assertTrue(overview.getSummary().getMaxAccounts() > 0);
    assertTrue(overview.getSummary().getMaxAliases() > 0);
    assertNotNull(overview.getDomains());
    assertFalse(overview.getDomains().isEmpty());

    EmailOverviewDomain domain =
        EmailOverviewDomain.builder().domain(testDomain).accounts(1).build();
    assertTrue(overview.getDomains().contains(domain));
  }