Class SdkAsserts

java.lang.Object
com.amazonaws.test.util.SdkAsserts

public class SdkAsserts extends Object
  • Constructor Details

    • SdkAsserts

      public SdkAsserts()
  • Method Details

    • assertNotEmpty

      @Deprecated public static void assertNotEmpty(String str)
      Deprecated.
      Use Hamcrest Matchers instead
      Asserts that the specified String is not null and not empty.
      Parameters:
      str - The String to test.
    • assertFileEqualsStream

      public static void assertFileEqualsStream(File expected, InputStream actual)
      Asserts that the contents in the specified file are exactly equal to the contents read from the specified input stream. The input stream will be closed at the end of this method. If any problems are encountered, or the stream's contents don't match up exactly with the file's contents, then this method will fail the current test.
      Parameters:
      expected - The file containing the expected contents.
      actual - The stream that will be read, compared to the expected file contents, and finally closed.
    • assertFileEqualsStream

      public static void assertFileEqualsStream(String errmsg, File expected, InputStream actual)
      Asserts that the contents in the specified file are exactly equal to the contents read from the specified input stream. The input stream will be closed at the end of this method. If any problems are encountered, or the stream's contents don't match up exactly with the file's contents, then this method will fail the current test.
      Parameters:
      errmsg - error message to be thrown when the assertion fails.
      expected - The file containing the expected contents.
      actual - The stream that will be read, compared to the expected file contents, and finally closed.
    • assertStreamEqualsStream

      public static void assertStreamEqualsStream(InputStream expected, InputStream actual)
      Asserts that the contents in the specified input streams are same. The input streams will be closed at the end of this method. If any problems are encountered, or the stream's contents don't match up exactly with the file's contents, then this method will fail the current test.
      Parameters:
      expected - expected input stream. The stream will be closed at the end.
      actual - The stream that will be read, compared to the expected file contents, and finally closed.
    • assertStreamEqualsStream

      public static void assertStreamEqualsStream(String errmsg, InputStream expectedInputStream, InputStream inputStream)
      Asserts that the contents in the specified input streams are same. The input streams will be closed at the end of this method. If any problems are encountered, or the stream's contents don't match up exactly with the file's contents, then this method will fail the current test.
      Parameters:
      errmsg - error message to be thrown when the assertion fails.
      expected - expected input stream. The stream will be closed at the end.
      actual - The stream that will be read, compared to the expected file contents, and finally closed.
    • assertFileEqualsFile

      public static void assertFileEqualsFile(File expected, File actual)
      Asserts that the contents of the two files are same.
      Parameters:
      expected - expected file.
      actual - actual file.
    • assertStringEqualsStream

      public static void assertStringEqualsStream(String expected, InputStream actual)
      Asserts that the contents in the specified string are exactly equal to the contents read from the specified input stream. The input stream will be closed at the end of this method. If any problems are encountered, or the stream's contents don't match up exactly with the string's contents, then this method will fail the current test.
      Parameters:
      expected - The string containing the expected data.
      actual - The stream that will be read, compared to the expected string data, and finally closed.
    • doesStreamEqualStream

      public static boolean doesStreamEqualStream(InputStream expected, InputStream actual) throws IOException
      Returns true if, and only if, the contents read from the specified input streams are exactly equal. Both input streams will be closed at the end of this method.
      Parameters:
      expected - The input stream containing the expected contents.
      inputStream - The stream that will be read, compared to the expected file contents, and finally closed.
      Returns:
      True if the two input streams contain the same data.
      Throws:
      IOException - If any problems are encountered comparing the file and stream.
    • doesFileEqualStream

      public static boolean doesFileEqualStream(File expectedFile, InputStream inputStream) throws IOException
      Returns true if, and only if, the contents in the specified file are exactly equal to the contents read from the specified input stream. The input stream will be closed at the end of this method.
      Parameters:
      expectedFile - The file containing the expected contents.
      inputStream - The stream that will be read, compared to the expected file contents, and finally closed.
      Throws:
      IOException - If any problems are encountered comparing the file and stream.
    • assertValidException

      public static void assertValidException(AmazonServiceException e)
      Asserts that the specified AmazonServiceException is valid, meaning it has a non-empty, non-null value for its message, requestId, etc.
      Parameters:
      e - The exception to validate.