ChangeCharEncodingService extends ServiceImp { public void setCharEncoding(String s) { charEncoding = s; } ChangeCharEncodingService();  ChangeCharEncodingService(String cs); @Override void doService(AdaptrisMessage msg); String getCharEncoding(); void setCharEncoding(String s); @Override void prepare();  }
@Test public void testSetCharEncoding() { ChangeCharEncodingService srv = new ChangeCharEncodingService(); assertNull(srv.getCharEncoding()); srv.setCharEncoding("UTF-8"); assertEquals("UTF-8", srv.getCharEncoding()); srv.setCharEncoding(null); assertEquals(null, srv.getCharEncoding()); }
@Test public void testChangeCharset() throws Exception { ChangeCharEncodingService srv = new ChangeCharEncodingService(); srv.setCharEncoding("iso-8859-1"); AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage("Hello"); assertNull(msg.getContentEncoding()); execute(srv, msg); assertEquals(Charset.forName("iso-8859-1"), Charset.forName(msg.getContentEncoding())); }