Class Matcher

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.assertions.Matcher
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable
Direct Known Subclasses:
Capture

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-11-06T23:25:03.195Z") @Stability(Stable) public abstract class Matcher extends software.amazon.jsii.JsiiObject
Represents a matcher that can perform special data matching capabilities between a given pattern and a target.

Example:

 // Given a template -
 // {
 //   "Resources": {
 //     "MyBar": {
 //       "Type": "Foo::Bar",
 //       "Properties": {
 //         "Fred": {
 //           "Wobble": ["Flob", "Flib"],
 //         }
 //       }
 //     }
 //   }
 // }
 // The following will NOT throw an assertion error
 template.hasResourceProperties("Foo::Bar", Map.of(
         "Fred", Map.of(
                 "Wobble", List.of(Match.anyValue(), Match.anyValue()))));
 // The following will throw an assertion error
 template.hasResourceProperties("Foo::Bar", Map.of(
         "Fred", Map.of(
                 "Wimble", Match.anyValue())));
 
  • Nested Class Summary

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

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

    Constructors
    Modifier
    Constructor
    Description
    protected
     
    protected
    Matcher(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
     
    protected
    Matcher(software.amazon.jsii.JsiiObjectRef objRef)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract String
    A name for the matcher.
    static Boolean
    Check whether the provided object is a subtype of the IMatcher.
    abstract MatchResult
    test(Object actual)
    Test whether a target matches the provided pattern.

    Methods inherited from class software.amazon.jsii.JsiiObject

    jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface software.amazon.jsii.JsiiSerializable

    $jsii$toJson
  • Constructor Details

    • Matcher

      protected Matcher(software.amazon.jsii.JsiiObjectRef objRef)
    • Matcher

      protected Matcher(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • Matcher

      @Stability(Stable) protected Matcher()
  • Method Details

    • isMatcher

      @Stability(Stable) @NotNull public static Boolean isMatcher(@NotNull Object x)
      Check whether the provided object is a subtype of the IMatcher.

      Parameters:
      x - This parameter is required.
    • test

      @Stability(Stable) @NotNull public abstract MatchResult test(@NotNull Object actual)
      Test whether a target matches the provided pattern.

      Every Matcher must implement this method. This method will be invoked by the assertions framework. Do not call this method directly.

      Parameters:
      actual - the target to match. This parameter is required.
      Returns:
      the list of match failures. An empty array denotes a successful match.
    • getName

      @Stability(Stable) @NotNull public abstract String getName()
      A name for the matcher.

      This is collected as part of the result and may be presented to the user.