@Test public void createWithMimeTypePassedAndWithHeaders() throws Exception { Map<String, Object> parameters = new HashMap<>(); parameters.put("headers", Collections.singletonMap("Content-Transfer-Encoding", "quoted-printable")); parameters.put("mimetype", "text/calendar"); MimeBodyPart bodyPart = this.mocker.getComponentUnderTest().create("Lorem ipsum", parameters); assertEquals("Lorem ipsum", bodyPart.getContent()); assertEquals("text/calendar", bodyPart.getContentType()); assertArrayEquals(new String[]{ "quoted-printable" }, bodyPart.getHeader("Content-Transfer-Encoding")); }
@Override public MimeBodyPart create(String content, Map<String, Object> parameters) throws MessagingException { MimeBodyPart bodyPart = new MimeBodyPart(); bodyPart.setContent(content, TEXT_PLAIN_CONTENT_TYPE); bodyPart.setHeader("Content-Type", getMimetype(parameters)); addHeaders(bodyPart, parameters); return bodyPart; }
TextMimeBodyPartFactory extends AbstractMimeBodyPartFactory<String> { @Override public MimeBodyPart create(String content, Map<String, Object> parameters) throws MessagingException { MimeBodyPart bodyPart = new MimeBodyPart(); bodyPart.setContent(content, TEXT_PLAIN_CONTENT_TYPE); bodyPart.setHeader("Content-Type", getMimetype(parameters)); addHeaders(bodyPart, parameters); return bodyPart; } }
TextMimeBodyPartFactory extends AbstractMimeBodyPartFactory<String> { @Override public MimeBodyPart create(String content, Map<String, Object> parameters) throws MessagingException { MimeBodyPart bodyPart = new MimeBodyPart(); bodyPart.setContent(content, TEXT_PLAIN_CONTENT_TYPE); bodyPart.setHeader("Content-Type", getMimetype(parameters)); addHeaders(bodyPart, parameters); return bodyPart; }  }
TextMimeBodyPartFactory extends AbstractMimeBodyPartFactory<String> { @Override public MimeBodyPart create(String content, Map<String, Object> parameters) throws MessagingException { MimeBodyPart bodyPart = new MimeBodyPart(); bodyPart.setContent(content, TEXT_PLAIN_CONTENT_TYPE); bodyPart.setHeader("Content-Type", getMimetype(parameters)); addHeaders(bodyPart, parameters); return bodyPart; }  @Override MimeBodyPart create(String content, Map<String, Object> parameters); }
TextMimeBodyPartFactory extends AbstractMimeBodyPartFactory<String> { @Override public MimeBodyPart create(String content, Map<String, Object> parameters) throws MessagingException { MimeBodyPart bodyPart = new MimeBodyPart(); bodyPart.setContent(content, TEXT_PLAIN_CONTENT_TYPE); bodyPart.setHeader("Content-Type", getMimetype(parameters)); addHeaders(bodyPart, parameters); return bodyPart; }  @Override MimeBodyPart create(String content, Map<String, Object> parameters);  }