Code example for Subject

    private NormalizedMessage message;
    private Subject subject;
    public void setUp() throws Exception { 
        subject = new Subject();
        message = new MessageUtil.NormalizedMessageImpl();
        message.setContent(new StringSource("<doc>s1<doc>"));
        message.addAttachment("a", new DataHandler(createDataSource("s2")));
        message.setProperty("p", "s3");
    public void tearDown() throws Exception { 
    public void testCopyContent() throws Exception { 
        MessageTransformer copier = new CopyTransformer(false, true, false, false);
        NormalizedMessage copy = copier.transform(null, message);
        String content = new SourceTransformer().toString(copy.getContent());
Connect your IDE to all the code out there  Get Codota for Java