Class InputStreams


  • public class InputStreams
    extends java.lang.Object
    Reusable assertions for InputStreams.
    • Constructor Detail

      • InputStreams

        InputStreams()
    • Method Detail

      • instance

        public static InputStreams instance()
        Returns the singleton instance of this class.
        Returns:
        the singleton instance of this class.
      • assertSameContentAs

        public void assertSameContentAs​(AssertionInfo info,
                                        java.io.InputStream actual,
                                        java.io.InputStream expected)
        Asserts that the given InputStreams have same content.
        Parameters:
        info - contains information about the assertion.
        actual - the "actual" InputStream.
        expected - the "expected" InputStream.
        Throws:
        java.lang.NullPointerException - if expected is null.
        java.lang.AssertionError - if actual is null.
        java.lang.AssertionError - if the given InputStreams do not have same content.
        InputStreamsException - if an I/O error occurs.
      • assertIsEmpty

        public void assertIsEmpty​(AssertionInfo info,
                                  java.io.InputStream actual)
        Asserts that the given InputStreams is empty.
        Parameters:
        info - contains information about the assertion.
        actual - the "actual" InputStream.
        Throws:
        java.lang.AssertionError - if actual is not empty.
        InputStreamsException - if an I/O error occurs.
      • assertIsNotEmpty

        public void assertIsNotEmpty​(AssertionInfo info,
                                     java.io.InputStream actual)
        Asserts that the given InputStreams is not empty.
        Parameters:
        info - contains information about the assertion.
        actual - the "actual" InputStream.
        Throws:
        java.lang.AssertionError - if actual is not empty.
        InputStreamsException - if an I/O error occurs.
      • assertHasContent

        public void assertHasContent​(AssertionInfo info,
                                     java.io.InputStream actual,
                                     java.lang.String expected)
        Asserts that the given InputStream has the same content as the given String.
        Parameters:
        info - contains information about the assertion.
        actual - the actual InputStream.
        expected - the expected String.
        Throws:
        java.lang.NullPointerException - if expected is null.
        java.lang.AssertionError - if actual is null.
        java.lang.AssertionError - if the given InputStream does not have the same content as the given String.
        InputStreamsException - if an I/O error occurs.
      • assertHasBinaryContent

        public void assertHasBinaryContent​(AssertionInfo info,
                                           java.io.InputStream actual,
                                           byte[] expected)
        Asserts that the given InputStream has the given binary content.
        Parameters:
        info - contains information about the assertion.
        actual - the actual InputStream.
        expected - the expected binary content.
        Throws:
        java.lang.NullPointerException - if expected is null.
        java.lang.AssertionError - if actual is null.
        java.lang.AssertionError - if the given InputStream does not have the same content as the given String.
        InputStreamsException - if an I/O error occurs.
      • assertNotNull

        private static void assertNotNull​(AssertionInfo info,
                                          java.io.InputStream stream)
      • assertHasDigest

        public void assertHasDigest​(AssertionInfo info,
                                    java.io.InputStream actual,
                                    java.security.MessageDigest digest,
                                    byte[] expected)
      • assertHasDigest

        public void assertHasDigest​(AssertionInfo info,
                                    java.io.InputStream actual,
                                    java.security.MessageDigest digest,
                                    java.lang.String expected)
      • assertHasDigest

        public void assertHasDigest​(AssertionInfo info,
                                    java.io.InputStream actual,
                                    java.lang.String algorithm,
                                    byte[] expected)
      • assertHasDigest

        public void assertHasDigest​(AssertionInfo info,
                                    java.io.InputStream actual,
                                    java.lang.String algorithm,
                                    java.lang.String expected)