### Question:
GroovyScriptHttpMessageConverter implements HttpMessageConverter<GroovyScript> { @Override public void write(GroovyScript t, String contentType, HttpOutputMessage outputMessage) throws IOException { String payload = "script=" + Streams.toString(t.getInputStream()); Streams.copy(payload, outputMessage.getBody()); }  @Override boolean canRead(Class<?> clazz); @Override boolean canWrite(Class<?> clazz); @Override void write(GroovyScript t, String contentType, HttpOutputMessage outputMessage); @Override GroovyScript read(Class<? extends GroovyScript> clazz, HttpInputMessage inputMessage);  }### Answer:
@Test public void write() throws Exception { GroovyScript script = new StringGroovyScript("print 'Hello, Jenkins!'"); MockHttpOutputMessage outputMessage = new MockHttpOutputMessage(); converter.write(script, null, outputMessage); assertEquals("script=print 'Hello, Jenkins!'", outputMessage.getBodyAsString()); }