### Question:
AbstractEncoder extends Encoder { @Override public final <T extends Serializable> Name<T> decode(String data) { if(data==null) { return null; } try { byte[] serializedData=BaseEncoding.base64().decode(data); Serializable subject=SerializationUtils.deserialize(serializedData, Serializable.class); return assemble(subject); } catch (IOException e) { throw new AssertionError("Deserialization should not fail",e); } }  @Override final String encode(Name<?> name); @Override final Name<T> decode(String data);  }### Answer:
@Test public void testDecode$null() throws Exception { TestProxy sut = new TestProxy(); Name<?> result = sut.decode(null); assertThat(result,nullValue()); }
@Test public void testDecode$exception(@Mocked final BaseEncoding encoding) throws Exception { final String data = "test"; new StrictExpectations() {{ BaseEncoding.base64();result=encoding; encoding.decode(data);result=new IOException("Serialization failure"); }}; TestProxy sut = new TestProxy(); try { sut.decode(data); } catch (AssertionError e) { assertThat(e.getCause(),instanceOf(IOException.class)); } }