public static <T> void coderDecodesBase64(Coder<T> coder, String base64Encoding, T value) throws Exception { assertThat( DECODING_WIRE_FORMAT_MESSAGE, CoderUtils.decodeFromBase64(coder, base64Encoding), equalTo(value)); }
W window = CoderUtils.decodeFromBase64(windowCoder, parts.get(1)); if (parts.size() > 3) { int index = Integer.parseInt(parts.get(2), WindowAndTriggerNamespace.TRIGGER_RADIX);
@SuppressWarnings("unchecked") public static <T, IterableT extends Iterable<T>> void coderDecodesBase64ContentsEqual( Coder<IterableT> coder, String base64Encoding, IterableT expected) throws Exception { IterableT result = CoderUtils.decodeFromBase64(coder, base64Encoding); if (Iterables.isEmpty(expected)) { assertThat(ENCODING_WIRE_FORMAT_MESSAGE, result, emptyIterable()); } else { assertThat( ENCODING_WIRE_FORMAT_MESSAGE, result, containsInAnyOrder((T[]) Iterables.toArray(expected, Object.class))); } }
@Test public void testClosingCoderFailsWhenDecodingBase64() throws Exception { expectedException.expect(UnsupportedOperationException.class); expectedException.expectMessage("Caller does not own the underlying"); CoderUtils.decodeFromBase64(new ClosingCoder(), "test-value"); }