### Question:
QuotedPrintableCodec implements BinaryEncoder, BinaryDecoder, StringEncoder, StringDecoder { @Override public byte[] decode(final byte[] bytes) throws DecoderException { return decodeQuotedPrintable(bytes); } QuotedPrintableCodec();  QuotedPrintableCodec(final boolean strict);  QuotedPrintableCodec(final Charset charset);  QuotedPrintableCodec(final Charset charset, final boolean strict);  QuotedPrintableCodec(final String charsetName); static final byte[] encodeQuotedPrintable(BitSet printable, final byte[] bytes); static final byte[] encodeQuotedPrintable(BitSet printable, final byte[] bytes, boolean strict); static final byte[] decodeQuotedPrintable(final byte[] bytes); @Override byte[] encode(final byte[] bytes); @Override byte[] decode(final byte[] bytes); @Override String encode(final String str); String decode(final String str, final Charset charset); String decode(final String str, final String charset); @Override String decode(final String str); @Override Object encode(final Object obj); @Override Object decode(final Object obj); Charset getCharset(); String getDefaultCharset(); String encode(final String str, final Charset charset); String encode(final String str, final String charset);  }### Answer:
@Test public void testDecodeInvalid() throws Exception { final QuotedPrintableCodec qpcodec = new QuotedPrintableCodec(); try { qpcodec.decode("="); fail("DecoderException should have been thrown"); } catch (final DecoderException e) { } try { qpcodec.decode("=A"); fail("DecoderException should have been thrown"); } catch (final DecoderException e) { } try { qpcodec.decode("=WW"); fail("DecoderException should have been thrown"); } catch (final DecoderException e) { } }
@Test public void testDecodeStringWithNull() throws Exception { final QuotedPrintableCodec qpcodec = new QuotedPrintableCodec(); final String test = null; final String result = qpcodec.decode( test, "charset" ); assertEquals("Result should be null", null, result); }
@Test public void testDecodeObjects() throws Exception { final QuotedPrintableCodec qpcodec = new QuotedPrintableCodec(); final String plain = "1+1 =3D 2"; String decoded = (String) qpcodec.decode((Object) plain); assertEquals("Basic quoted-printable decoding test", "1+1 = 2", decoded); final byte[] plainBA = plain.getBytes(Charsets.UTF_8); final byte[] decodedBA = (byte[]) qpcodec.decode((Object) plainBA); decoded = new String(decodedBA); assertEquals("Basic quoted-printable decoding test", "1+1 = 2", decoded); final Object result = qpcodec.decode((Object) null); assertEquals( "Decoding a null Object should return null", null, result); try { final Object dObj = new Double(3.0); qpcodec.decode( dObj ); fail( "Trying to url encode a Double object should cause an exception."); } catch (final DecoderException ee) { } }