@Test public void test_deserialize_type_wrong() { exception.expect(IllegalArgumentException.class); exception.expectMessage("Target type must be assignable from String"); assertThat(codec.deserialize(EOF, getClass()), is(equalTo(""))); }
@Override public <T> T deserialize(String encoded, Class<T> target) throws DiagnosticCodecException { requireNonNull(encoded); requireNonNull(target); if (!target.isAssignableFrom(String.class)) { throw new IllegalArgumentException("Target type must be assignable from String"); } if (!encoded.endsWith(EOF)) { throw new DiagnosticCodecException("Unsupported encoded input"); } return target.cast(encoded.substring(0, encoded.length() - 3)); }
EmptyParameterDiagnosticCodec extends DiagnosticCodecSkeleton<String> { @Override public <T> T deserialize(String encoded, Class<T> target) throws DiagnosticCodecException { requireNonNull(encoded); requireNonNull(target); if (!target.isAssignableFrom(String.class)) { throw new IllegalArgumentException("Target type must be assignable from String"); } if (!encoded.endsWith(EOF)) { throw new DiagnosticCodecException("Unsupported encoded input"); } return target.cast(encoded.substring(0, encoded.length() - 3)); } }
EmptyParameterDiagnosticCodec extends DiagnosticCodecSkeleton<String> { @Override public <T> T deserialize(String encoded, Class<T> target) throws DiagnosticCodecException { requireNonNull(encoded); requireNonNull(target); if (!target.isAssignableFrom(String.class)) { throw new IllegalArgumentException("Target type must be assignable from String"); } if (!encoded.endsWith(EOF)) { throw new DiagnosticCodecException("Unsupported encoded input"); } return target.cast(encoded.substring(0, encoded.length() - 3)); } EmptyParameterDiagnosticCodec(); }
EmptyParameterDiagnosticCodec extends DiagnosticCodecSkeleton<String> { @Override public <T> T deserialize(String encoded, Class<T> target) throws DiagnosticCodecException { requireNonNull(encoded); requireNonNull(target); if (!target.isAssignableFrom(String.class)) { throw new IllegalArgumentException("Target type must be assignable from String"); } if (!encoded.endsWith(EOF)) { throw new DiagnosticCodecException("Unsupported encoded input"); } return target.cast(encoded.substring(0, encoded.length() - 3)); } EmptyParameterDiagnosticCodec(); @Override String serialize(Object o); @Override T deserialize(String encoded, Class<T> target); @Override String toString(); }
EmptyParameterDiagnosticCodec extends DiagnosticCodecSkeleton<String> { @Override public <T> T deserialize(String encoded, Class<T> target) throws DiagnosticCodecException { requireNonNull(encoded); requireNonNull(target); if (!target.isAssignableFrom(String.class)) { throw new IllegalArgumentException("Target type must be assignable from String"); } if (!encoded.endsWith(EOF)) { throw new DiagnosticCodecException("Unsupported encoded input"); } return target.cast(encoded.substring(0, encoded.length() - 3)); } EmptyParameterDiagnosticCodec(); @Override String serialize(Object o); @Override T deserialize(String encoded, Class<T> target); @Override String toString();  }