private void testWriteAndReadConfigSnapshot(Coder<String> coder) throws IOException {
CoderTypeSerializer<String> serializer = new CoderTypeSerializer<>(coder);
TypeSerializerSnapshot writtenSnapshot = serializer.snapshotConfiguration();
ComparatorTestBase.TestOutputView outView = new ComparatorTestBase.TestOutputView();
writtenSnapshot.writeSnapshot(outView);
TypeSerializerSnapshot readSnapshot = new CoderTypeSerializer.LegacySnapshot();
readSnapshot.readSnapshot(
writtenSnapshot.getCurrentVersion(), outView.getInputView(), getClass().getClassLoader());
assertThat(readSnapshot.restoreSerializer(), is(serializer));
}