ListCoder extends IterableLikeCoder<T, List<T>> { public static <T> ListCoder<T> of(Coder<T> elemCoder) { return new ListCoder<>(elemCoder); } protected  ListCoder(Coder<T> elemCoder); static ListCoder<T> of(Coder<T> elemCoder); @Override boolean consistentWithEquals(); @Override Object structuralValue(List<T> values); @Override void verifyDeterministic(); @Override TypeDescriptor<List<T>> getEncodedTypeDescriptor();  }
@Test public void testCoderIsSerializableWithWellKnownCoderType() throws Exception { CoderProperties.coderSerializable(ListCoder.of(GlobalWindow.Coder.INSTANCE)); }
@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 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 testListWithNullsAndSerializableCoder() throws Exception { List<Integer> list = Arrays.asList(1, 2, 3, null, 4); Coder<List<Integer>> coder = ListCoder.of(SerializableCoder.of(Integer.class)); CoderProperties.coderDecodeEncodeEqual(coder, list); }
@Test public void testStructuralValueDecodeEncodeEqual() throws Exception { ListCoder<byte[]> coder = ListCoder.of(ByteArrayCoder.of()); List<byte[]> value = Collections.singletonList(new byte[] {1, 2, 3, 4}); CoderProperties.structuralValueDecodeEncodeEqual(coder, value); }