Package org.apache.beam.sdk.testing
Class FileChecksumMatcher
- java.lang.Object
-
- org.hamcrest.BaseMatcher<T>
-
- org.hamcrest.TypeSafeMatcher<ShardedFile>
-
- org.apache.beam.sdk.testing.FileChecksumMatcher
-
- All Implemented Interfaces:
java.io.Serializable
,SerializableMatcher<ShardedFile>
,org.hamcrest.Matcher<ShardedFile>
,org.hamcrest.SelfDescribing
public class FileChecksumMatcher extends org.hamcrest.TypeSafeMatcher<ShardedFile> implements SerializableMatcher<ShardedFile>
Matcher to verify checksum of the contents of anShardedFile
in E2E test.For example:
orassertThat(new NumberedShardedFile(filePath), fileContentsHaveChecksum(checksumString));
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:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
describeMismatchSafely(ShardedFile shardedFile, org.hamcrest.Description description)
void
describeTo(org.hamcrest.Description description)
static FileChecksumMatcher
fileContentsHaveChecksum(java.lang.String checksum)
boolean
matchesSafely(ShardedFile shardedFile)
-
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toString
-
-
-
-
Method Detail
-
fileContentsHaveChecksum
public static FileChecksumMatcher fileContentsHaveChecksum(java.lang.String checksum)
-
matchesSafely
public boolean matchesSafely(ShardedFile shardedFile)
- Specified by:
matchesSafely
in classorg.hamcrest.TypeSafeMatcher<ShardedFile>
-
describeTo
public void describeTo(org.hamcrest.Description description)
- Specified by:
describeTo
in interfaceorg.hamcrest.SelfDescribing
-
describeMismatchSafely
public void describeMismatchSafely(ShardedFile shardedFile, org.hamcrest.Description description)
- Overrides:
describeMismatchSafely
in classorg.hamcrest.TypeSafeMatcher<ShardedFile>
-
-