Class ByteSourceAssert

    • Constructor Detail

      • ByteSourceAssert

        protected ByteSourceAssert​(com.google.common.io.ByteSource actual)
    • Method Detail

      • hasSameContentAs

        public ByteSourceAssert hasSameContentAs​(com.google.common.io.ByteSource other)
                                          throws java.io.IOException
        Verifies that the actual ByteSource has the same content as the provided one.

        Example :

         ByteSource actual = ByteSource.wrap(new byte[1]);
         ByteSource other = ByteSource.wrap(new byte[1]);
        
         assertThat(actual).hasSameContentAs(other);
        Parameters:
        other - ByteSource to compare against.
        Returns:
        this ByteSourceAssert for assertions chaining.
        Throws:
        java.io.IOException - if ByteSource.contentEquals(com.google.common.io.ByteSource) throws one.
        java.lang.AssertionError - if the actual ByteSource is null.
        java.lang.AssertionError - if the actual ByteSource does not contain the same content.
      • isEmpty

        public void isEmpty()
                     throws java.io.IOException
        Verifies that the actual ByteSource is empty.

        Example :

         ByteSource actual = ByteSource.wrap(new byte[0]);
        
         assertThat(actual).isEmpty();
        Throws:
        java.io.IOException - if ByteSource.isEmpty() throws one.
        java.lang.AssertionError - if the actual ByteSource is null.
        java.lang.AssertionError - if the actual ByteSource is not empty.
      • hasSize

        public ByteSourceAssert hasSize​(long expectedSize)
                                 throws java.io.IOException
        Verifies that the size of the actual ByteSource is equal to the given one.

        Example :

         ByteSource actual = ByteSource.wrap(new byte[9]);
        
         assertThat(actual).hasSize(9);
        Parameters:
        expectedSize - the expected size of actual ByteSource.
        Returns:
        this ByteSourceAssert for assertions chaining.
        Throws:
        java.io.IOException - if ByteSource.size() throws one.
        java.lang.AssertionError - if the actual ByteSource is null.
        java.lang.AssertionError - if the number of values of the actual ByteSource is not equal to the given one.