Class AnyInteractionDescriptor

  • All Implemented Interfaces:
    software.amazon.jsii.JsiiSerializable
    Direct Known Subclasses:
    WillCallFunction, WillCallThrowingFunction, WillReceiveFunctionCall, WillReceiveFunctionCallAndThrow, WillReceiveHttpRequest, WillSendHttpRequest

    @Generated(value="jsii-pacmak/1.112.0 (build de1bc80)",
               date="2025-08-20T01:46:20.829Z")
    @Stability(Stable)
    public abstract class AnyInteractionDescriptor
    extends software.amazon.jsii.JsiiObject
    The base class for all ContractCase Mock Descriptors. Extend this if you are implementing your own mock type.

    If you are using the included example types from ContractCase (or any extension libraries), you do not need to read the documentation for this class.

    Mock description type strings beginning with _case: are reserved for the default ContractCase matchers. Only use a types prefixed with _case: if you wish to create a DSL for a special case for a matching behaviour that is already provided by a core ContractCase mock.

    • Nested Class Summary

      • Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject

        software.amazon.jsii.JsiiObject.InitializationMode
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      String stringify()
      This method returns the entire example as a JSON string, as a convenience so that wrapper libraries don't need to figure out how to walk a tree of example objects.
      Object toJSON()
      Only override this method if you are writing a matcher in a language other than TypeScript.
      • Methods inherited from class software.amazon.jsii.JsiiObject

        jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
      • Methods inherited from interface software.amazon.jsii.JsiiSerializable

        $jsii$toJson
    • Constructor Detail

      • AnyInteractionDescriptor

        protected AnyInteractionDescriptor​(software.amazon.jsii.JsiiObjectRef objRef)
      • AnyInteractionDescriptor

        protected AnyInteractionDescriptor​(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
      • AnyInteractionDescriptor

        @Stability(Stable)
        protected AnyInteractionDescriptor​(@NotNull
                                           String mockType,
                                           @NotNull
                                           ContractCaseCoreSetup setup)
        The base class for all ContractCase Mock Descriptors. Extend this if you are implementing your own mock type.

        If you are using the included example types from ContractCase (or any extension libraries), you do not need to read the documentation for this class.

        Mock description type strings beginning with _case: are reserved for the default ContractCase matchers. Only use a types prefixed with _case: if you wish to create a DSL for a special case for a matching behaviour that is already provided by a core ContractCase mock.

        Parameters:
        mockType - This parameter is required.
        setup - This parameter is required.
    • Method Detail

      • stringify

        @Stability(Stable)
        @NotNull
        public String stringify()
        This method returns the entire example as a JSON string, as a convenience so that wrapper libraries don't need to figure out how to walk a tree of example objects.

        You shouldn't need to override this method.

        Returns:
        A JSON string representation of this mock.
      • toJSON

        @Stability(Stable)
        @NotNull
        public Object toJSON()
        Only override this method if you are writing a matcher in a language other than TypeScript.

        It exists because the ContractCase matcher format is not legal in all languages that ContractCase supports.

        It isn't called by any implementation directly, it's used on the javascript side by JSON.stringify().

        Calling it from a wrapper library will return unhelpful results, as JSii can't map all objects that it returns.

        WARNING: Do not return a string from this method. You must instead return an object that can be serialised to JSON following the matcher format described in Extending ContractCase.

        Returns:
        An object in the matcher format described in the Extending ContractCase documentation.