@Test
public void writesStringToOutputStream() throws Exception {

    MediaType mediaType = new MediaType("text", "plain", ImmutableMap.of("charset", "windows-1251"));
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    stringEntityProvider.writeTo(TEST_CONTENT, String.class, null, null, mediaType, new MultivaluedHashMap<>(), out);
    assertArrayEquals(TEST_CONTENT.getBytes("windows-1251"), out.toByteArray());
}