Package com.alibaba.citrus.service.mail.builder.content

Examples of com.alibaba.citrus.service.mail.builder.content.TextContent


                                                         REGEX_EOL + REGEX_EOL + "$"));
    }

    @Test
    public void with_content() throws Exception {
        initContent(new TextContent("hello, world"));

        assertEquals("text/plain", content.getContentType()); // default content type

        assertThat(getMessageAsText(), containsAllRegex( //
                                                         "Content-Type: text/plain; charset=UTF-8" + REGEX_EOL, //
View Full Code Here


                                                         "hello, world$"));
    }

    @Test
    public void with_content_and_type() throws Exception {
        initContent(new TextContent("hello, world", "text/html"));

        assertEquals("text/html", content.getContentType());

        assertThat(getMessageAsText(), containsAllRegex( //
                                                         "Content-Type: text/html; charset=UTF-8" + REGEX_EOL, //
View Full Code Here

                                                         "hello, world$"));
    }

    @Test
    public void toString_defaultContentType() {
        initContent(new TextContent("hello, world"));

        String result = "";

        result += "TextContent {\n";
        result += "  contentType = text/plain\n";
View Full Code Here

        assertEquals(result, content.toString());
    }

    @Test
    public void toString_specifiedContentType() {
        initContent(new TextContent("hello, world", "text/html"));

        String result = "";

        result += "TextContent {\n";
        result += "  contentType = text/html\n";
View Full Code Here

    protected MailBuilder createMailBuilder(String subject, String addr) {
        MailBuilder builder = new MailBuilder();

        builder.setSubject(subject);
        builder.setContent(new TextContent());
        builder.setAddress(MailAddressType.TO, addr);

        return builder;
    }
View Full Code Here

    private MultipartContent multipart;
    private String           multipartContentType;

    @Before
    public void init() throws Exception {
        content1 = new TextContent("content1");
        content2 = new TextContent("content2", "text/html");

        multipart = (MultipartContent) multipartClass.newInstance();
        multipart.addContent(content1);
        multipart.addContent(content2);
View Full Code Here

        attachable.setId("attachable");

        MultipartContent alternative = new AlternativeMultipartContent();
        alternative.setId("alternative");

        TextContent plainText = new TextContent("我爱北京敏感词", "text/plain");
        plainText.setId("plainText");

        TextContent htmlText = new TextContent("<爱北京敏感词>", "text/html");
        htmlText.setId("htmlText");

        TextTemplateContent plainTextTemplate = new TextTemplateContent("mail/mytemplate.vm", "text/plain");
        plainTextTemplate.setId("plainTextTemplate");

        AttachmentContent textAttachment = new AttachmentContent("testfile.txt");
View Full Code Here

        // mailBuilder
        MailBuilder attached = new MailBuilder();

        attached.setSubject("附件标题");
        attached.setContent(new TextContent("我爱北京敏感词", "text/plain"));

        content = new AttachmentContent(attached);
        builder.setContent(content);

        assert_Mail_我爱北京敏感词();
View Full Code Here

        // message
        MailBuilder attached = new MailBuilder();

        attached.setSubject("附件标题");
        attached.setContent(new TextContent("我爱北京敏感词", "text/plain"));

        Message mail = attached.getMessage(rawSession);

        content = new AttachmentContent(mail);
        builder.setContent(content);
View Full Code Here

        }

        // ref
        MailBuilder attached = new MailBuilder();
        attached.setSubject("附件标题");
        attached.setContent(new TextContent("我爱北京敏感词", "text/plain"));

        MailService service = createMock(MailService.class);
        expect(service.getMailBuilder("attachedMail")).andReturn(attached);
        expect(service.getMailBuilder("notExistMail")).andThrow(new MailNotFoundException());
        replay(service);
View Full Code Here

TOP

Related Classes of com.alibaba.citrus.service.mail.builder.content.TextContent

Copyright © 2018 www.massapicom. 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.