CoderUtils { public static <T> T decodeFromByteArray(Coder<T> coder, byte[] encodedValue) throws CoderException { return decodeFromByteArray(coder, encodedValue, Coder.Context.OUTER); } private  CoderUtils(); static byte[] encodeToByteArray(Coder<T> coder, T value); static byte[] encodeToByteArray(Coder<T> coder, T value, Coder.Context context); static T decodeFromByteArray(Coder<T> coder, byte[] encodedValue); static T decodeFromByteArray(
      Coder<T> coder, byte[] encodedValue, Coder.Context context); static T clone(Coder<T> coder, T value); static String encodeToBase64(Coder<T> coder, T value); static T decodeFromBase64(Coder<T> coder, String encodedValue); @SuppressWarnings({"rawtypes", "unchecked"}) static TypeDescriptor getCodedType(TypeDescriptor coderDescriptor);  }
@Test public void testClosingCoderFailsWhenDecodingByteArray() throws Exception { expectedException.expect(UnsupportedOperationException.class); expectedException.expectMessage("Caller does not own the underlying"); CoderUtils.decodeFromByteArray(new ClosingCoder(), new byte[0]); }
@Test public void testClosingCoderFailsWhenDecodingByteArrayInContext() throws Exception { expectedException.expect(UnsupportedOperationException.class); expectedException.expectMessage("Caller does not own the underlying"); CoderUtils.decodeFromByteArray(new ClosingCoder(), new byte[0], Context.NESTED); }