Class: AWSCDK::Assertions::MatchFailure

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
assertions/match_failure.rb

Overview

Match failure details.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(matcher:, message:, path:, cost: nil) ⇒ MatchFailure

Returns a new instance of MatchFailure.

Parameters:

  • matcher (AWSCDK::Assertions::Matcher)

    The matcher that had the failure.

  • message (String)

    Failure message.

  • path (Array<String>)

    The relative path in the target where the failure occurred.

  • cost (Numeric, nil) (defaults to: nil)

    The cost of this particular mismatch.



11
12
13
14
15
16
17
18
19
20
# File 'assertions/match_failure.rb', line 11

def initialize(matcher:, message:, path:, cost: nil)
  @matcher = matcher
  Jsii::Type.check_type(@matcher, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hc3NlcnRpb25zLk1hdGNoZXIifQ==")), "matcher")
  @message = message
  Jsii::Type.check_type(@message, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "message")
  @path = path
  Jsii::Type.check_type(@path, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "path")
  @cost = cost
  Jsii::Type.check_type(@cost, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "cost") unless @cost.nil?
end

Instance Attribute Details

#costNumeric? (readonly)

Note:

Default: 1

The cost of this particular mismatch.

Returns:

  • (Numeric, nil)


42
43
44
# File 'assertions/match_failure.rb', line 42

def cost
  @cost
end

#matcherAWSCDK::Assertions::Matcher (readonly)

The matcher that had the failure.



25
26
27
# File 'assertions/match_failure.rb', line 25

def matcher
  @matcher
end

#messageString (readonly)

Failure message.

Returns:

  • (String)


29
30
31
# File 'assertions/match_failure.rb', line 29

def message
  @message
end

#pathArray<String> (readonly)

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]'].

Returns:

  • (Array<String>)


37
38
39
# File 'assertions/match_failure.rb', line 37

def path
  @path
end

Class Method Details

.jsii_propertiesObject



44
45
46
47
48
49
50
51
# File 'assertions/match_failure.rb', line 44

def self.jsii_properties
  {
    :matcher => "matcher",
    :message => "message",
    :path => "path",
    :cost => "cost",
  }
end

Instance Method Details

#to_jsiiObject



53
54
55
56
57
58
59
60
61
62
# File 'assertions/match_failure.rb', line 53

def to_jsii
  result = {}
  result.merge!({
    "matcher" => @matcher,
    "message" => @message,
    "path" => @path,
    "cost" => @cost,
  })
  result.compact
end