Examples of FakeMail


Examples of org.apache.mailet.base.test.FakeMail

    }

    // test if exception was thrown
    public void testInvalidConfig() throws MessagingException {
        boolean exception = false;
        FakeMail mockedMail = setupMail(MailUtil.createMimeMessage());
        setConfig1("test");

        try {
            setupMailet();
            mailet.service(mockedMail);
View Full Code Here

Examples of org.apache.mailet.base.test.FakeMail

        mockedMimeMessage.saveChanges();
        return mockedMimeMessage;
    }
   
    private Mail getMockedMail(MimeMessage message) {
        Mail m = new FakeMail();
        m.setMessage(message);
        return m;
    }
View Full Code Here

Examples of org.apache.mailet.base.test.FakeMail

    public SizeGreaterThanTest(String arg0) throws UnsupportedEncodingException {
        super(arg0);
    }

    private void setupMockedMail(long size) throws ParseException {
        mockedMail = new FakeMail();
        mockedMail.setMessageSize(size);
        mockedMail.setRecipients(Arrays.asList(new MailAddress("test@email")));

    }
View Full Code Here

Examples of org.apache.mailet.base.test.FakeMail

        FakeMailetConfig mci = new FakeMailetConfig("Test",new FakeMailContext());
        mci.setProperty("text",footer);

        mailet.init(mci);

        Mail mail = new FakeMail();
        mail.setMessage(new MimeMessage(Session
                .getDefaultInstance(new Properties()),
                new ByteArrayInputStream(asciisource.getBytes())));

        mailet.service(mail);

        ByteArrayOutputStream rawMessage = new ByteArrayOutputStream();
        mail.getMessage().writeTo(
                rawMessage,
                new String[] { "Bcc", "Content-Length", "Message-ID" });
        return rawMessage.toString();
    }
View Full Code Here

Examples of org.apache.mailet.base.test.FakeMail

    }

    // test if the Header was add
    public void testHeaderIsPresent() throws MessagingException {
        MimeMessage mockedMimeMessage = MailUtil.createMimeMessage(headerName, headerValue);
        FakeMail mockedMail = MailUtil.createMockMail2Recipients(mockedMimeMessage);
        setupMailet();

        mailet.service(mockedMail);

        assertEquals(HEADER_VALUE, mockedMail.getMessage().getHeader(
                HEADER_NAME)[0]);

    }
View Full Code Here

Examples of org.apache.mailet.base.test.FakeMail

    public void testHeaderIsReplaced() throws MessagingException {
        setHeaderName(HEADER_NAME);
        setHeaderValue(headerValue);

        MimeMessage mockedMimeMessage = MailUtil.createMimeMessage(headerName, headerValue);
        FakeMail mockedMail = MailUtil.createMockMail2Recipients(mockedMimeMessage);
        setupMailet();

        mailet.service(mockedMail);

        assertEquals(HEADER_VALUE, mockedMail.getMessage().getHeader(
                HEADER_NAME)[0]);

    }
View Full Code Here

Examples of org.apache.mailet.base.test.FakeMail

    public NullTest(String arg0) throws UnsupportedEncodingException {
        super(arg0);
    }

    private void setupMockedMail(MimeMessage m) throws ParseException {
        mockedMail = new FakeMail();
        mockedMail.setMessage(m);
        mockedMail.setRecipients(Arrays.asList(new MailAddress("test@james.apache.org"),
                new MailAddress("test2@james.apache.org")));

    }
View Full Code Here

Examples of org.apache.mailet.base.test.FakeMail

    public OrTest(String arg0) throws UnsupportedEncodingException {
        super(arg0);
    }

    private void setupMockedMail() throws ParseException {
        mockedMail = new FakeMail();
        mockedMail.setRecipients(Arrays.asList(new MailAddress[] {
        new MailAddress("test@james.apache.org"),
        new MailAddress("test2@james.apache.org") }));

    }
View Full Code Here

Examples of org.apache.mailet.base.test.FakeMail

    public XorTest(String arg0) throws UnsupportedEncodingException {
        super(arg0);
    }

    private void setupMockedMail() throws ParseException {
        mockedMail = new FakeMail();
        mockedMail.setRecipients(Arrays.asList(new MailAddress[] {
        new MailAddress("test@james.apache.org"),
        new MailAddress("test2@james.apache.org") }));

    }
View Full Code Here

Examples of org.apache.mailet.base.test.FakeMail

    public AndTest(String arg0) throws UnsupportedEncodingException {
        super(arg0);
    }

    private void setupMockedMail() throws ParseException {
        mockedMail = new FakeMail();
        mockedMail.setRecipients(Arrays.asList(new MailAddress[] {
        new MailAddress("test@james.apache.org"),
        new MailAddress("test2@james.apache.org") }));

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.