Class ByteSourceAssert

  • All Implemented Interfaces:
    org.assertj.core.api.Assert<ByteSourceAssert,​com.google.common.io.ByteSource>, org.assertj.core.api.Descriptable<ByteSourceAssert>, org.assertj.core.api.ExtensionPoints<ByteSourceAssert,​com.google.common.io.ByteSource>

    public class ByteSourceAssert
    extends org.assertj.core.api.AbstractAssert<ByteSourceAssert,​com.google.common.io.ByteSource>
    Assertions for Guava ByteSource.
    Author:
    Andrew Gaul
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) org.assertj.core.internal.Failures failures  
      • Fields inherited from class org.assertj.core.api.AbstractAssert

        actual, info, myself, objects, throwUnsupportedExceptionOnEquals
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected ByteSourceAssert​(com.google.common.io.ByteSource actual)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ByteSourceAssert hasSameContentAs​(com.google.common.io.ByteSource other)
      Verifies that the actual ByteSource contains has the same content as the provided one.
      ByteSourceAssert hasSize​(long expectedSize)
      Verifies that the size of the actual ByteSource is equal to the given one.
      void isEmpty()
      Verifies that the actual ByteSource is empty.
      • Methods inherited from class org.assertj.core.api.AbstractAssert

        asInstanceOf, asList, assertionError, asString, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, equals, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, inBinary, inHexadecimal, is, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, matches, matches, newListAssertInstance, overridingErrorMessage, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, setCustomRepresentation, throwAssertionError, usingComparator, usingComparator, usingDefaultComparator, usingRecursiveComparison, usingRecursiveComparison, withFailMessage, withRepresentation, withThreadDumpOnError
      • Methods inherited from interface org.assertj.core.api.Descriptable

        as, as, describedAs
    • Field Detail

      • failures

        org.assertj.core.internal.Failures failures
    • Constructor Detail

      • ByteSourceAssert

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

      • hasSameContentAs

        public ByteSourceAssert hasSameContentAs​(com.google.common.io.ByteSource other)
                                          throws IOException
        Verifies that the actual ByteSource contains 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:
        IOException - if ByteSource.contentEquals(com.google.common.io.ByteSource) throws one.
        AssertionError - if the actual ByteSource is null.
        AssertionError - if the actual ByteSource does not contain the same content.
      • isEmpty

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

        Example :

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

        public ByteSourceAssert hasSize​(long expectedSize)
                                 throws 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:
        IOException - if ByteSource.size() throws one.
        AssertionError - if the actual ByteSource is null.
        AssertionError - if the number of values of the actual ByteSource is not equal to the given one.