CoderUtils { public static <T> String encodeToBase64(Coder<T> coder, T value) throws CoderException { byte[] rawValue = encodeToByteArray(coder, value); return BaseEncoding.base64Url().omitPadding().encode(rawValue); } 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 testClosingCoderFailsWhenEncodingToBase64() throws Exception { expectedException.expect(UnsupportedOperationException.class); expectedException.expectMessage("Caller does not own the underlying"); CoderUtils.encodeToBase64(new ClosingCoder(), "test-value"); }