### Question:
TextToHtml implements Transformer { @Override public InputStream transform(InputStream input, Charset charset) throws IOException { Preconditions.checkNotNull(input); Preconditions.checkNotNull(charset); List<String> lines = CharStreams.readLines(new InputStreamReader(input, charset)); String html = "<html><body>" + Joiner.on("<br/>").join(lines) + "</body></html>"; return new ByteArrayInputStream(html.getBytes(charset)); }  @Override InputStream transform(InputStream input, Charset charset); @Override MSEmailBodyType targetType();  }### Answer:
@Test(expected=NullPointerException.class) public void transformNull() throws IOException { testee.transform(null, Charsets.UTF_8); }
@Test(expected=NullPointerException.class) public void transformNullCharset() throws IOException { testee.transform(new ByteArrayInputStream(new byte[] {0x22}), null); }
@Test public void transformSimpleString() throws IOException { ByteArrayInputStream inputStream = stringToInputStream("simple string"); InputStream actual = testee.transform(inputStream, Charsets.UTF_8); assertThat(actual).hasContentEqualTo(stringToInputStream("<html><body>simple string</body></html>")); }
@Test public void transformMultilineString() throws IOException { ByteArrayInputStream inputStream = stringToInputStream("line one\r\nline two\r\n"); InputStream actual = testee.transform(inputStream, Charsets.UTF_8); assertThat(actual).hasContentEqualTo(stringToInputStream("<html><body>line one<br/>line two</body></html>")); }