Class FileChecksumMatcher

java.lang.Object
org.hamcrest.BaseMatcher<org.apache.beam.sdk.util.ShardedFile>
org.hamcrest.TypeSafeMatcher<org.apache.beam.sdk.util.ShardedFile>
org.apache.beam.sdk.testing.FileChecksumMatcher
All Implemented Interfaces:
Serializable, SerializableMatcher<org.apache.beam.sdk.util.ShardedFile>, Matcher<org.apache.beam.sdk.util.ShardedFile>, SelfDescribing

public class FileChecksumMatcher extends TypeSafeMatcher<org.apache.beam.sdk.util.ShardedFile> implements SerializableMatcher<org.apache.beam.sdk.util.ShardedFile>
Matcher to verify checksum of the contents of an ShardedFile in E2E test.

For example:


 assertThat(new NumberedShardedFile(filePath), fileContentsHaveChecksum(checksumString));
 
or

 assertThat(new NumberedShardedFile(filePath, shardTemplate), fileContentsHaveChecksum(checksumString));
 

Checksum of outputs is generated based on SHA-1 algorithm. If output file is empty, SHA-1 hash of empty string (da39a3ee5e6b4b0d3255bfef95601890afd80709) is used as expected.

See Also: