コード例 #1
0
ファイル: AddressesTest.java プロジェクト: MexinaD/CMDBuild
  @Test
  public void addressesStrippedFromContactDetails() throws Exception {
    // given
    send(
        newMail(FOO, PASSWORD) //
            .withFrom(address(BAZ, BAZ_AT_EXAMPLE_DOT_COM)) //
            .withTo(address(FOO, FOO_AT_EXAMPLE_DOT_COM)) //
            .withCc(address(BAR, BAR_AT_EXAMPLE_DOT_COM)) //
            .withSubject(SUBJECT) //
            .withContent(PLAIN_TEXT_CONTENT));
    final FetchedMail fetchedMail =
        mailApi
            .selectFolder(INBOX) //
            .fetch() //
            .iterator()
            .next();

    // when
    final GetMail getMail = mailApi.selectMail(fetchedMail).get();

    // then
    assertThat(getMail.getFrom(), equalTo(BAZ_AT_EXAMPLE_DOT_COM));
    assertThat(getMail.getTos(), containsInAnyOrder(FOO_AT_EXAMPLE_DOT_COM));
    assertThat(getMail.getCcs(), containsInAnyOrder(BAR_AT_EXAMPLE_DOT_COM));
  }
コード例 #2
0
ファイル: AddressesTest.java プロジェクト: MexinaD/CMDBuild
  @Test
  public void allAddresses() throws Exception {
    // given
    send(
        newMail(FOO, PASSWORD) //
            .withTo(collectionOf(FOO_AT_EXAMPLE_DOT_COM, ANOTHER_FOO_AT_EXAMPLE_DOT_COM)) //
            .withCc(arrayOf(BAR_AT_EXAMPLE_DOT_COM, ANOTHER_BAR_AT_EXAMPLE_DOT_COM)) //
            .withBcc(BAZ_AT_EXAMPLE_DOT_COM, ANOTHER_BAZ_AT_EXAMPLE_DOT_COM) //
            .withSubject(SUBJECT) //
            .withContent(PLAIN_TEXT_CONTENT));
    final FetchedMail fetchedMail =
        mailApi
            .selectFolder(INBOX) //
            .fetch() //
            .iterator()
            .next();

    // when
    final GetMail getMail = mailApi.selectMail(fetchedMail).get();

    // then
    assertThat(getMail.getFrom(), equalTo(FOO_AT_EXAMPLE_DOT_COM));
    assertThat(
        getMail.getTos(),
        containsInAnyOrder(FOO_AT_EXAMPLE_DOT_COM, ANOTHER_FOO_AT_EXAMPLE_DOT_COM));
    assertThat(size(getMail.getTos()), equalTo(2));
    assertThat(
        getMail.getCcs(),
        containsInAnyOrder(BAR_AT_EXAMPLE_DOT_COM, ANOTHER_BAR_AT_EXAMPLE_DOT_COM));
    assertThat(size(getMail.getCcs()), equalTo(2));
  }