public static Test suite() {
return new TestSuite(TestMultipartContentBody.class);
}
public void testStringBody() throws Exception {
StringBody b1 = new StringBody("text");
assertEquals(4, b1.getContentLength());
Charset defCharset = Charset.defaultCharset();
assertEquals(defCharset.name(), b1.getCharset());
assertEquals(defCharset.name(), b1.getContentTypeParameters().get("charset"));
assertNull(b1.getFilename());
assertEquals("text/plain", b1.getMimeType());
assertEquals("text", b1.getMediaType());
assertEquals("plain", b1.getSubType());
assertEquals(MIME.ENC_8BIT, b1.getTransferEncoding());
StringBody b2 = new StringBody("more text", "text/other", MIME.DEFAULT_CHARSET);
assertEquals(9, b2.getContentLength());
assertEquals(MIME.DEFAULT_CHARSET.name(), b2.getCharset());
assertEquals(MIME.DEFAULT_CHARSET.name(), b2.getContentTypeParameters().get("charset"));
assertNull(b2.getFilename());
assertEquals("text/other", b2.getMimeType());
assertEquals("text", b2.getMediaType());
assertEquals("other", b2.getSubType());
assertEquals(MIME.ENC_8BIT, b2.getTransferEncoding());
}