### Question:
WCHAREncoder { public byte[] toByteArray(String toEncodeString) { Preconditions.checkNotNull(toEncodeString); return toEncodeString.getBytes(Charsets.UTF_16LE); } @Inject @VisibleForTesting  WCHAREncoder(); byte[] toByteArray(String toEncodeString); String byteArrayToEncode(byte[] toEncodeByteArray);  }### Answer:
@Test(expected=NullPointerException.class) public void testEncodeNull() { new WCHAREncoder().toByteArray(null); }
@Test public void testEncodeEmpty() { byte[] byteArray = new WCHAREncoder().toByteArray(""); Assertions.assertThat(byteArray).isEmpty(); }
@Test public void testEncodeRegularString() { byte[] byteArray = new WCHAREncoder().toByteArray("hello"); Assertions.assertThat(byteArray).isEqualTo( new byte[]{104, 0, 101, 0, 108, 0, 108, 0, 111, 0}); }