Class BaseTestHelper.TestResource

  • Enclosing class:
    BaseTestHelper

    public final class BaseTestHelper.TestResource
    extends java.lang.Object
    A manipulator of a pair of (actual file, expected file).
    • Constructor Summary

      Constructors 
      Constructor Description
      TestResource()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void assertActualFileContentSameAsExpected()
      Assert that the content of the actual file are the same as the expected file.
      java.lang.String readStringFromResource()
      Reads the content from the resource file as a single string.
      void writeToActualFile​(byte[] bytes)
      Writes the given bytes to the actual file.
      void writeToActualFile​(java.lang.Iterable<java.lang.String> strings)
      Writes the given strings to the actual file.
      void writeToActualFile​(java.lang.String... strings)
      Writes the given strings to the actual file.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TestResource

        public TestResource()
    • Method Detail

      • assertActualFileContentSameAsExpected

        public void assertActualFileContentSameAsExpected()
                                                   throws java.io.IOException
        Assert that the content of the actual file are the same as the expected file.
        Throws:
        java.io.IOException - in case of error
      • writeToActualFile

        public void writeToActualFile​(@Nonnull
                                      java.lang.String... strings)
                               throws java.io.IOException
        Writes the given strings to the actual file.
        Parameters:
        strings - the strings
        Throws:
        java.io.IOException - in case of error
      • writeToActualFile

        public void writeToActualFile​(@Nonnull
                                      java.lang.Iterable<java.lang.String> strings)
                               throws java.io.IOException
        Writes the given strings to the actual file.
        Parameters:
        strings - the strings
        Throws:
        java.io.IOException - in case of error
      • writeToActualFile

        public void writeToActualFile​(@Nonnull
                                      byte[] bytes)
                               throws java.io.IOException
        Writes the given bytes to the actual file.
        Parameters:
        bytes - the bytes
        Throws:
        java.io.IOException - in case of error
      • readStringFromResource

        @Nonnull
        public java.lang.String readStringFromResource()
                                                throws java.io.IOException
        Reads the content from the resource file as a single string.
        Returns:
        the string
        Throws:
        java.io.IOException - in case of error