@Test
public void createGeneratorWithNonUtf8EncodingNotSupported() throws IOException {

    // given
    SingleThreadJsonFactory factory = new SingleThreadJsonFactory();
    expectedException.expect(UnsupportedEncodingException.class);
    expectedException.expectMessage("Encoding not supported: " + JsonEncoding.UTF16_BE.getJavaName());
    // when
    factory.createGenerator(mock(OutputStream.class), JsonEncoding.UTF16_BE);
}