Skip to content
v2.278.0

MatchFailure Struct ​

Match failure details.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { assertions } from 'aws-cdk-lib';

declare const matcher: assertions.Matcher;
const matchFailure: assertions.MatchFailure = {
  matcher: matcher,
  message: 'message',
  path: ['path'],

  // the properties below are optional
  cost: 123,
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import assertions

# matcher: assertions.Matcher

match_failure = assertions.MatchFailure(
    matcher=matcher,
    message="message",
    path=["path"],

    # the properties below are optional
    cost=123
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.assertions.*;

Matcher matcher;

MatchFailure matchFailure = MatchFailure.builder()
        .matcher(matcher)
        .message("message")
        .path(List.of("path"))

        // the properties below are optional
        .cost(123)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.Assertions;

Matcher matcher;

var matchFailure = new MatchFailure {
    Matcher = matcher,
    Message = "message",
    Path = new [] { "path" },

    // the properties below are optional
    Cost = 123
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var matcher Matcher

matchFailure := &MatchFailure{
	Matcher: matcher,
	Message: jsii.String("message"),
	Path: []*string{
		jsii.String("path"),
	},

	// the properties below are optional
	Cost: jsii.Number(123),
}

Properties ​

costoptionalnumbercostoptionalint | floatcostoptionalNumberCostoptionaldoubleCostoptional*float64 = 1 #
The cost of this particular mismatch.
matcherMatchermatcherMatchermatcherMatcherMatcherMatcherMatcherMatcher required #
The matcher that had the failure.
messagestringmessagestrmessageStringMessagestringMessage*string required #
Failure message.
pathstring[]pathtyping.List[str]pathList<String>Pathstring[]Path*[]*string required #
The relative path in the target where the failure occurred.

If the failure occurred at root of the match tree, set the path to an empty list. If it occurs in the 5th index of an array nested within the 'foo' key of an object, set the path as ['/foo', '[5]'].