コード例 #1
0
ファイル: TestBasics.java プロジェクト: peke2/test_scala
  /** More missing chunk testing, this time for missing recipient email address */
  public void testMissingAddressChunk() throws Exception {
    assertEquals(false, noRecipientAddress.isReturnNullOnMissingChunk());

    try {
      noRecipientAddress.getRecipientEmailAddress();
      fail();
    } catch (ChunkNotFoundException e) {
      // Good
    }
    try {
      noRecipientAddress.getRecipientEmailAddressList();
      fail();
    } catch (ChunkNotFoundException e) {
      // Good
    }

    noRecipientAddress.setReturnNullOnMissingChunk(true);

    noRecipientAddress.getRecipientEmailAddress();
    noRecipientAddress.getRecipientEmailAddressList();
    assertEquals("", noRecipientAddress.getRecipientEmailAddress());
    assertEquals(1, noRecipientAddress.getRecipientEmailAddressList().length);
    assertEquals(null, noRecipientAddress.getRecipientEmailAddressList()[0]);

    // Check a few other bits too
    assertEquals("Microsoft Outlook 2003 Team", noRecipientAddress.getDisplayFrom());
    assertEquals("New Outlook User", noRecipientAddress.getDisplayTo());

    noRecipientAddress.setReturnNullOnMissingChunk(false);
  }
コード例 #2
0
ファイル: TestBasics.java プロジェクト: peke2/test_scala
  /** Test missing chunks. Use a file with no HTML body */
  public void testMissingChunks() throws Exception {
    assertEquals(false, attachments.isReturnNullOnMissingChunk());

    try {
      attachments.getHtmlBody();
      fail();
    } catch (ChunkNotFoundException e) {
      // Good
    }

    attachments.setReturnNullOnMissingChunk(true);

    assertEquals(null, attachments.getHtmlBody());

    attachments.setReturnNullOnMissingChunk(false);

    try {
      attachments.getHtmlBody();
      fail();
    } catch (ChunkNotFoundException e) {
      // Good
    }
  }