### Question:
WriterFormat extends Format<Consumer<Supplier<Writer>>> { public static WriterFormat writer() { return new WriterFormat(); } private  WriterFormat(); static WriterFormat writer(); @Override M set(final M message, final Consumer<Supplier<Writer>> value);  }### Answer:
@Test void testWriteToOutputUsingCharset() { final String text="ça va"; final String charset="ISO-8859-1"; new MessageMock() .header("Content-Type", "text/plain; charset="+charset) .body(writer(), supplier -> { try ( final Writer writer=supplier.get() ) { writer.write(text); } catch ( final IOException e ) { throw new UncheckedIOException(e); } }) .body(output()) .fold( value -> { try ( final ByteArrayOutputStream buffer=new ByteArrayOutputStream() ) { value.accept(() -> buffer); return assertThat(buffer.toByteArray()) .as("written using provided charset") .isEqualTo(text.getBytes(charset)); } catch ( final IOException unexpected ) { throw new UncheckedIOException(unexpected); } }, error -> fail(error.toString()) ); }