Class TestResult<O>

java.lang.Object
software.amazon.lambda.durable.testing.TestResult<O>
Type Parameters:
O - the handler output type

public class TestResult<O> extends Object
Represents the result of a durable execution, providing access to the execution status, output, operations, and history events.
  • Constructor Summary

    Constructors
    Constructor
    Description
    TestResult(software.amazon.lambda.durable.model.ExecutionStatus status, String resultPayload, software.amazon.awssdk.services.lambda.model.ErrorObject error, List<TestOperation> operations, List<software.amazon.awssdk.services.lambda.model.Event> allEvents, software.amazon.lambda.durable.TypeToken<O> resultType, software.amazon.lambda.durable.serde.SerDes serDes)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Optional<software.amazon.awssdk.services.lambda.model.ErrorObject>
    Returns the execution error, if present.
    List<software.amazon.awssdk.services.lambda.model.Event>
    Returns the raw history events for the given operation name, or an empty list if not found.
    Returns all operations that failed, were cancelled, timed out, or stopped.
    List<software.amazon.awssdk.services.lambda.model.Event>
    Returns all raw history events from the execution.
    Returns the TestOperation with the given name, or null if not found.
    Returns all operations from the execution.
    Deserializes and returns the execution output if the result type is known.
    <T> T
    getResult(Class<T> resultType)
    Deserializes and returns the execution output, throwing if the execution did not succeed.
    <T> T
    getResult(software.amazon.lambda.durable.TypeToken<T> resultType)
    Deserializes and returns the execution output using a TypeToken for generic types.
    software.amazon.lambda.durable.model.ExecutionStatus
    Returns the execution status (SUCCEEDED, FAILED, or PENDING).
    Returns all operations that completed successfully.
    boolean
    Returns true if the execution failed.
    boolean
    Returns true if the execution completed successfully.

    Methods inherited from class java.lang.Object

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

    • TestResult

      public TestResult(software.amazon.lambda.durable.model.ExecutionStatus status, String resultPayload, software.amazon.awssdk.services.lambda.model.ErrorObject error, List<TestOperation> operations, List<software.amazon.awssdk.services.lambda.model.Event> allEvents, software.amazon.lambda.durable.TypeToken<O> resultType, software.amazon.lambda.durable.serde.SerDes serDes)
  • Method Details

    • getStatus

      public software.amazon.lambda.durable.model.ExecutionStatus getStatus()
      Returns the execution status (SUCCEEDED, FAILED, or PENDING).
    • getResult

      public <T> T getResult(Class<T> resultType)
      Deserializes and returns the execution output, throwing if the execution did not succeed.
    • getResult

      public <T> T getResult(software.amazon.lambda.durable.TypeToken<T> resultType)
      Deserializes and returns the execution output using a TypeToken for generic types.
    • getResult

      public O getResult()
      Deserializes and returns the execution output if the result type is known.
    • getError

      public Optional<software.amazon.awssdk.services.lambda.model.ErrorObject> getError()
      Returns the execution error, if present.
    • getOperations

      public List<TestOperation> getOperations()
      Returns all operations from the execution.
    • getOperation

      public TestOperation getOperation(String name)
      Returns the TestOperation with the given name, or null if not found.
    • getHistoryEvents

      public List<software.amazon.awssdk.services.lambda.model.Event> getHistoryEvents()
      Returns all raw history events from the execution.
    • getEventsForOperation

      public List<software.amazon.awssdk.services.lambda.model.Event> getEventsForOperation(String operationName)
      Returns the raw history events for the given operation name, or an empty list if not found.
    • isSucceeded

      public boolean isSucceeded()
      Returns true if the execution completed successfully.
    • isFailed

      public boolean isFailed()
      Returns true if the execution failed.
    • getSucceededOperations

      public List<TestOperation> getSucceededOperations()
      Returns all operations that completed successfully.
    • getFailedOperations

      public List<TestOperation> getFailedOperations()
      Returns all operations that failed, were cancelled, timed out, or stopped.