@Test public void testInitializeWithString() throws IOException { String content = "content"; String contentType = "application/json"; ParseByteArrayHttpBody body = new ParseByteArrayHttpBody(content, contentType); assertArrayEquals(content.getBytes(), ParseIOUtils.toByteArray(body.getContent())); assertEquals(contentType, body.getContentType()); assertEquals(7, body.getContentLength()); }
@Test public void testInitializeWithByteArray() throws IOException { byte[] content = {1, 1, 1, 1, 1}; String contentType = "application/json"; ParseByteArrayHttpBody body = new ParseByteArrayHttpBody(content, contentType); assertArrayEquals(content, ParseIOUtils.toByteArray(body.getContent())); assertEquals(contentType, body.getContentType()); assertEquals(5, body.getContentLength()); }