StringPart extends AbstractPart { @Override public ContentType getContentType() { return contentType; } StringPart(String name, String content);  StringPart(String name, String content, String charset);  StringPart(String name, String content, String charset, ContentType contentType); @Override ContentType getContentType(); @Override InputStream getContent();  }
@Test public void shouldReturnSameContentType() { ContentType contentType = ContentType.CONTENT_TYPE_TEXT_JSON; Part part = new StringPart(name, content, charset, contentType); ContentType returnContentType = part.getContentType(); assertThat(contentType, is(returnContentType)); }
@Test public void shouldReturnPlainContentTypeIfDefault() { ContentType contentType = ContentType.CONTENT_TYPE_TEXT_PLAIN; Part part = new StringPart(name, content, charset); ContentType returnContentType = part.getContentType(); assertThat(contentType, is(returnContentType)); }