@SuppressWarnings("unchecked")
@Test
public void testWriteTo() throws Exception {
MessageBodyWriter p = new BinaryDataProvider();
ByteArrayOutputStream os = new ByteArrayOutputStream();
p.writeTo(new byte[]{'h', 'i'}, null, null, os);
assertTrue(Arrays.equals(new String("hi").getBytes(), os.toByteArray()));
ByteArrayInputStream is = new ByteArrayInputStream("hi".getBytes());
os = new ByteArrayOutputStream();
p.writeTo(is, null, null, os);
assertTrue(Arrays.equals(os.toByteArray(), new String("hi").getBytes()));