### Question:
PlatOnTypeEncoder { @SuppressWarnings("unchecked") public static String encode(Type parameter) { if (parameter instanceof IntType) { return encodeInt(((IntType) parameter)); }else if (parameter instanceof Utf8String) { return encodeString((Utf8String) parameter); }else { throw new UnsupportedOperationException( "Type cannot be encoded: " + parameter.getClass()); } } private  PlatOnTypeEncoder(); @SuppressWarnings("unchecked") static String encode(Type parameter);  }### Answer:
@Test public void testUintEncode() { Uint zero = new Uint64(BigInteger.ZERO); assertThat(PlatOnTypeEncoder.encode(zero), is("0000000000000000")); Uint maxLong = new Uint64(BigInteger.valueOf(Long.MAX_VALUE)); assertThat(PlatOnTypeEncoder.encode(maxLong), is("7fffffffffffffff")); }
@Test public void testIntEncode() { Int zero = new Int64(BigInteger.ZERO); assertThat(PlatOnTypeEncoder.encode(zero), is("0000000000000000")); Int maxLong = new Int64(BigInteger.valueOf(Long.MAX_VALUE)); assertThat(PlatOnTypeEncoder.encode(maxLong), is("7fffffffffffffff")); Int minLong = new Int64(BigInteger.valueOf(Long.MIN_VALUE)); assertThat(PlatOnTypeEncoder.encode(minLong), is("8000000000000000")); Int minusOne = new Int64(BigInteger.valueOf(-1)); assertThat(PlatOnTypeEncoder.encode(minusOne), is("ffffffffffffffff")); }
@Test public void testUtf8String() { Utf8String string = new Utf8String("Hello, world!"); assertThat(PlatOnTypeEncoder.encode(string), is("48656c6c6f2c20776f726c6421")); }