### Question:
PlatOnTypeDecoder { @SuppressWarnings("unchecked") public static <T extends Type> T decode(byte[] data, Class<T> type) { if (NumericType.class.isAssignableFrom(type)) { return (T) decodeNumeric(data, (Class<NumericType>) type); } else if (Utf8String.class.isAssignableFrom(type)) { return (T)decodeUtf8String(data); } else { throw new UnsupportedOperationException( "Type cannot be encoded: " + type.getClass()); } }  @SuppressWarnings("unchecked") static T decode(byte[] data, Class<T> type);  }### Answer:
@Test public void testUintDecode() { assertThat(PlatOnTypeDecoder.decode( Numeric.hexStringToByteArray("0000000000000000"), Uint64.class ), is(new Uint64(BigInteger.ZERO))); assertThat(PlatOnTypeDecoder.decode( Numeric.hexStringToByteArray("7fffffffffffffff"), Uint64.class ), is(new Uint64(BigInteger.valueOf(Long.MAX_VALUE)))); }
@Test public void testIntDecode() { assertThat(PlatOnTypeDecoder.decode( Numeric.hexStringToByteArray("0000000000000000"), Int64.class ), is(new Int64(BigInteger.ZERO))); assertThat(PlatOnTypeDecoder.decode( Numeric.hexStringToByteArray("7fffffffffffffff"), Int64.class ), is(new Int64(BigInteger.valueOf(Long.MAX_VALUE)))); assertThat(PlatOnTypeDecoder.decode( Numeric.hexStringToByteArray("8000000000000000"), Int64.class ), is(new Int64(BigInteger.valueOf(Long.MIN_VALUE)))); assertThat(PlatOnTypeDecoder.decode( Numeric.hexStringToByteArray("ffffffffffffffff"), Int64.class ), is(new Int64(BigInteger.valueOf(-1)))); }
@Test public void testUtf8String() { assertThat(PlatOnTypeDecoder.decode( Numeric.hexStringToByteArray("48656c6c6f2c20776f726c6421"), Utf8String.class), is(new Utf8String("Hello, world!"))); }