Class TestFailureExpectation

java.lang.Object
software.amazon.smithy.protocoltests.traits.TestFailureExpectation
All Implemented Interfaces:
ToNode

public final class TestFailureExpectation extends Object implements ToNode
Defines the expected failure of a test.

This can be any error response, or a specific error response.

  • Method Details

    • anyError

      public static TestFailureExpectation anyError()
      Returns:
      Returns an expectation that a test will fail with an unspecified error.
    • errorWithId

      public static TestFailureExpectation errorWithId(ShapeId errorId)
      Create an expectation that a test will fail with a specified error.
      Parameters:
      errorId - Shape ID of the expected error.
      Returns:
      Returns a specific error expectation.
    • getErrorId

      public Optional<ShapeId> getErrorId()
      Gets the ID of the expected error shape.

      If present, it indicates the test should throw a matching error. Otherwise, the test should throw any error.

      Returns:
      The ID of the expected error shape.
    • toNode

      public Node toNode()
      Description copied from interface: ToNode
      Converts a value to a Node.
      Specified by:
      toNode in interface ToNode
      Returns:
      Returns the creates Node.
    • fromNode

      public static TestFailureExpectation fromNode(Node node)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object