@Test public void testDecodeEncodeEqual() throws Exception { for (Integer value : TEST_VALUES) { CoderProperties.coderDecodeEncodeEqual(TEST_CODER, value); } }
@Test public void testDecodeEncodeEquals() throws Exception { for (BitSet value : TEST_VALUES) { CoderProperties.coderDecodeEncodeEqual(TEST_CODER, value); } }
@Test public void testBasicEncoding() throws Exception { for (Instant value : TEST_VALUES) { CoderProperties.coderDecodeEncodeEqual(TEST_CODER, value); } }
@Test public void testDecodeEncodeEqual() throws Exception { for (BigDecimal value : TEST_VALUES) { CoderProperties.coderDecodeEncodeEqual(TEST_CODER, value); } }
@Test public void testDecodeEncodeContentsInSameOrder() throws Exception { for (String value : TEST_VALUES) { CoderProperties.coderDecodeEncodeEqual(TEST_CODER, value); } }
@Test public void testDecodeEncodeEqualInAllContexts() throws Exception { for (ByteString value : TEST_VALUES) { CoderProperties.coderDecodeEncodeEqual(TEST_CODER, value); } }
@Test public void testDecodeEncodeEqual() throws Exception { for (String uriString : TEST_URI_STRINGS) { CoderProperties.coderDecodeEncodeEqual(uriCoder, new URI(uriString)); } }
@Test public void testDecodeEncodeEqual() throws Exception { for (Integer value : TEST_VALUES) { CoderProperties.coderDecodeEncodeEqual(TEST_CODER, value); } }
@Test public void testDecodeEncodeEqual() throws Exception { for (Set<Integer> value : TEST_VALUES) { CoderProperties.coderDecodeEncodeEqual(TEST_CODER, value); } }
@Test public void testCountSumCoderEncodeDecode() throws Exception { for (CountSum<Number> value : TEST_VALUES) { CoderProperties.coderDecodeEncodeEqual(TEST_CODER, value); } }
@Test public void testDecodeEncodeEqual() throws Exception { for (Byte value : TEST_VALUES) { CoderProperties.coderDecodeEncodeEqual(TEST_CODER, value); } }
@Test public void testBasicEncoding() throws Exception { for (ReadableDuration value : TEST_VALUES) { CoderProperties.coderDecodeEncodeEqual(TEST_CODER, value); } }
@Test public void testNullWritableEncoding() throws Exception { NullWritable value = NullWritable.get(); WritableCoder<NullWritable> coder = WritableCoder.of(NullWritable.class); CoderProperties.coderDecodeEncodeEqual(coder, value); }
@Test public void testEmptyList() throws Exception { List<Integer> list = Collections.emptyList(); Coder<List<Integer>> coder = ListCoder.of(VarIntCoder.of()); CoderProperties.coderDecodeEncodeEqual(coder, list); }
@Test public void testBadCoderThatDependsOnChangingState() throws Exception { AssertionError error = null; try { CoderProperties.coderDecodeEncodeEqual(new StateChangingSerializingCoder(), "TestData"); } catch (AssertionError e) { error = e; } assertNotNull("Expected AssertionError", error); assertThat(error.getMessage(), CoreMatchers.containsString("TestData")); }
@Test public void testPojoEncoding() throws Exception { Pojo value = new Pojo("Hello", 42); AvroCoder<Pojo> coder = AvroCoder.of(Pojo.class); CoderProperties.coderDecodeEncodeEqual(coder, value); }
@Test public void testListWithNullsAndVarIntCoderThrowsException() throws Exception { thrown.expect(CoderException.class); thrown.expectMessage("cannot encode a null Integer"); List<Integer> list = Arrays.asList(1, 2, 3, null, 4); Coder<List<Integer>> coder = ListCoder.of(VarIntCoder.of()); CoderProperties.coderDecodeEncodeEqual(coder, list); }
@Test public void testBadCoderThatDependsOnStateThatIsLost() throws Exception { expectedException.expect(RuntimeException.class); expectedException.expectMessage("I forgot something..."); CoderProperties.coderDecodeEncodeEqual(new ForgetfulSerializingCoder(1), "TestData"); }
@Test public void testTimerCoderWithConsistentWithEqualsPayloadCoder() throws Exception { Coder<Timer<String>> coder = Timer.Coder.of(StringUtf8Coder.of()); CoderProperties.coderDecodeEncodeEqual(coder, Timer.of(INSTANT, "ABC")); CoderProperties.coderConsistentWithEquals( coder, Timer.of(INSTANT, "ABC"), Timer.of(INSTANT, "ABC")); CoderProperties.coderDeterministic(coder, Timer.of(INSTANT, "ABC"), Timer.of(INSTANT, "ABC")); }
@Test public void testCoderEncodeDecodeEqual() throws Exception { MessageA value = MessageA.newBuilder() .setField1("hello") .addField2(MessageB.newBuilder().setField1(true).build()) .addField2(MessageB.newBuilder().setField1(false).build()) .build(); CoderProperties.coderDecodeEncodeEqual(ProtoCoder.of(MessageA.class), value); }