MetadataCoderV2 extends AtomicCoder<Metadata> { public static MetadataCoderV2 of() { return INSTANCE; } private  MetadataCoderV2(); static MetadataCoderV2 of(); @Override void encode(Metadata value, OutputStream os); @Override Metadata decode(InputStream is); @Override boolean consistentWithEquals();  }
@Test public void testEncodeDecodeWithDefaultLastModifiedMills() throws Exception { Path filePath = tmpFolder.newFile("somefile").toPath(); Metadata metadata = Metadata.builder() .setResourceId( FileSystems.matchNewResource(filePath.toString(), false )) .setIsReadSeekEfficient(true) .setSizeBytes(1024) .build(); CoderProperties.coderDecodeEncodeEqual(MetadataCoderV2.of(), metadata); }
@Test public void testEncodeDecodeWithCustomLastModifiedMills() throws Exception { Path filePath = tmpFolder.newFile("somefile").toPath(); Metadata metadata = Metadata.builder() .setResourceId( FileSystems.matchNewResource(filePath.toString(), false )) .setIsReadSeekEfficient(true) .setSizeBytes(1024) .setLastModifiedMillis(1541097000L) .build(); CoderProperties.coderDecodeEncodeEqual(MetadataCoderV2.of(), metadata); }
@Test public void testCoderSerializable() { CoderProperties.coderSerializable(MetadataCoderV2.of()); }