Class 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 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:
    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.TypeSafeMatcher

        describeMismatch, matches
      • Methods inherited from class org.hamcrest.BaseMatcher

        _dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface org.hamcrest.Matcher

        _dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, matches
    • Method Detail

      • fileContentsHaveChecksum

        public static FileChecksumMatcher fileContentsHaveChecksum​(java.lang.String checksum)
      • matchesSafely

        public boolean matchesSafely​(ShardedFile shardedFile)
        Specified by:
        matchesSafely in class org.hamcrest.TypeSafeMatcher<ShardedFile>
      • describeTo

        public void describeTo​(org.hamcrest.Description description)
        Specified by:
        describeTo in interface org.hamcrest.SelfDescribing
      • describeMismatchSafely

        public void describeMismatchSafely​(ShardedFile shardedFile,
                                           org.hamcrest.Description description)
        Overrides:
        describeMismatchSafely in class org.hamcrest.TypeSafeMatcher<ShardedFile>