Package org.apache.beam.sdk.testing
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:
-
Method Summary
Modifier and TypeMethodDescriptionvoiddescribeMismatchSafely(org.apache.beam.sdk.util.ShardedFile shardedFile, Description description) voiddescribeTo(Description description) static FileChecksumMatcherfileContentsHaveChecksum(String checksum) booleanmatchesSafely(org.apache.beam.sdk.util.ShardedFile shardedFile) Methods inherited from class org.hamcrest.TypeSafeMatcher
describeMismatch, matchesMethods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.hamcrest.Matcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, matches
-
Method Details
-
fileContentsHaveChecksum
-
matchesSafely
public boolean matchesSafely(org.apache.beam.sdk.util.ShardedFile shardedFile) - Specified by:
matchesSafelyin classTypeSafeMatcher<org.apache.beam.sdk.util.ShardedFile>
-
describeTo
- Specified by:
describeToin interfaceSelfDescribing
-
describeMismatchSafely
public void describeMismatchSafely(org.apache.beam.sdk.util.ShardedFile shardedFile, Description description) - Overrides:
describeMismatchSafelyin classTypeSafeMatcher<org.apache.beam.sdk.util.ShardedFile>
-