### Question:
QCodec extends RFC1522Codec implements StringEncoder, StringDecoder { @Override public String decode(final String str) throws DecoderException { if (str == null) { return null; } try { return decodeText(str); } catch (final UnsupportedEncodingException e) { throw new DecoderException(e.getMessage(), e); } } QCodec();  QCodec(final Charset charset);  QCodec(final String charsetName); String encode(final String str, final Charset charset); String encode(final String str, final String charset); @Override String encode(final String str); @Override String decode(final String str); @Override Object encode(final Object obj); @Override Object decode(final Object obj); Charset getCharset(); String getDefaultCharset(); boolean isEncodeBlanks(); void setEncodeBlanks(final boolean b);  }### Answer:
@Test public void testDecodeStringWithNull() throws Exception { final QCodec qcodec = new QCodec(); final String test = null; final String result = qcodec.decode( test ); assertEquals("Result should be null", null, result); }
@Test public void testDecodeObjects() throws Exception { final QCodec qcodec = new QCodec(); final String decoded = "=?UTF-8?Q?1+1 =3D 2?="; final String plain = (String) qcodec.decode((Object) decoded); assertEquals("Basic Q decoding test", "1+1 = 2", plain); final Object result = qcodec.decode((Object) null); assertEquals( "Decoding a null Object should return null", null, result); try { final Object dObj = new Double(3.0); qcodec.decode( dObj ); fail( "Trying to url encode a Double object should cause an exception."); } catch (final DecoderException ee) { } }