Class: AWSCDK::Assertions::MatchResult

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

Overview

The result of Match.test().

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target) ⇒ MatchResult

Returns a new instance of MatchResult.

Parameters:

  • target (Object)


9
10
11
12
# File 'assertions/match_result.rb', line 9

def initialize(target)
  Jsii::Type.check_type(target, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "target")
  Jsii::Object.instance_method(:initialize).bind(self).call(target)
end

Class Method Details

.jsii_overridable_methodsObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'assertions/match_result.rb', line 14

def self.jsii_overridable_methods
  {
    :fail_cost => { kind: :property, name: "failCost", is_optional: false },
    :fail_count => { kind: :property, name: "failCount", is_optional: false },
    :is_success => { kind: :property, name: "isSuccess", is_optional: false },
    :target => { kind: :property, name: "target", is_optional: false },
    :compose => { kind: :method, name: "compose", is_optional: false },
    :finished => { kind: :method, name: "finished", is_optional: false },
    :has_failed => { kind: :method, name: "hasFailed", is_optional: false },
    :push => { kind: :method, name: "push", is_optional: false },
    :record_capture => { kind: :method, name: "recordCapture", is_optional: false },
    :record_failure => { kind: :method, name: "recordFailure", is_optional: false },
    :render_mismatch => { kind: :method, name: "renderMismatch", is_optional: false },
    :to_human_strings => { kind: :method, name: "toHumanStrings", is_optional: false },
  }
end

Instance Method Details

#compose(id, inner) ⇒ AWSCDK::Assertions::MatchResult

Compose the results of a previous match as a subtree.

Parameters:

  • id (String)

    the id of the parent tree.

  • inner (AWSCDK::Assertions::MatchResult)

Returns:

  • (AWSCDK::Assertions::MatchResult)


64
65
66
67
68
# File 'assertions/match_result.rb', line 64

def compose(id, inner)
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  Jsii::Type.check_type(inner, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hc3NlcnRpb25zLk1hdGNoUmVzdWx0In0=")), "inner")
  jsii_call_method("compose", [id, inner])
end

#fail_costNumeric

The cost of the failures so far.

Returns:

  • (Numeric)


34
35
36
# File 'assertions/match_result.rb', line 34

def fail_cost()
  jsii_get_property("failCost")
end

#fail_countNumeric

The number of failures.

Returns:

  • (Numeric)


41
42
43
# File 'assertions/match_result.rb', line 41

def fail_count()
  jsii_get_property("failCount")
end

#finishedAWSCDK::Assertions::MatchResult

Prepare the result to be analyzed.

This API must be called prior to analyzing these results.

Returns:

  • (AWSCDK::Assertions::MatchResult)


75
76
77
# File 'assertions/match_result.rb', line 75

def finished()
  jsii_call_method("finished", [])
end

#has_failedBoolean

Does the result contain any failures.

If not, the result is a success

Returns:

  • (Boolean)


84
85
86
# File 'assertions/match_result.rb', line 84

def has_failed()
  jsii_call_method("hasFailed", [])
end

#is_successBoolean

Whether the match is a success.

Returns:

  • (Boolean)


48
49
50
# File 'assertions/match_result.rb', line 48

def is_success()
  jsii_get_property("isSuccess")
end

#push(matcher, path, message) ⇒ AWSCDK::Assertions::MatchResult

Deprecated.

use recordFailure()

DEPRECATED.

Parameters:

Returns:

  • (AWSCDK::Assertions::MatchResult)


95
96
97
98
99
100
# File 'assertions/match_result.rb', line 95

def push(matcher, path, message)
  Jsii::Type.check_type(matcher, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hc3NlcnRpb25zLk1hdGNoZXIifQ==")), "matcher")
  Jsii::Type.check_type(path, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "path")
  Jsii::Type.check_type(message, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "message")
  jsii_call_method("push", [matcher, path, message])
end

#record_capture(options) ⇒ void

This method returns an undefined value.

Record a capture against in this match result.

Parameters:



106
107
108
109
110
# File 'assertions/match_result.rb', line 106

def record_capture(options)
  options = options.is_a?(Hash) ? ::AWSCDK::Assertions::MatchCapture.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hc3NlcnRpb25zLk1hdGNoQ2FwdHVyZSJ9")), "options")
  jsii_call_method("recordCapture", [options])
end

#record_failure(failure) ⇒ AWSCDK::Assertions::MatchResult

Record a new failure into this result at a specific path.

Parameters:

Returns:

  • (AWSCDK::Assertions::MatchResult)


116
117
118
119
120
# File 'assertions/match_result.rb', line 116

def record_failure(failure)
  failure = failure.is_a?(Hash) ? ::AWSCDK::Assertions::MatchFailure.new(**failure.transform_keys(&:to_sym)) : failure
  Jsii::Type.check_type(failure, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hc3NlcnRpb25zLk1hdGNoRmFpbHVyZSJ9")), "failure")
  jsii_call_method("recordFailure", [failure])
end

#render_mismatchString

Do a deep render of the match result, showing the structure mismatches in context.

Returns:

  • (String)


125
126
127
# File 'assertions/match_result.rb', line 125

def render_mismatch()
  jsii_call_method("renderMismatch", [])
end

#targetObject

The target for which this result was generated.

Returns:

  • (Object)


55
56
57
# File 'assertions/match_result.rb', line 55

def target()
  jsii_get_property("target")
end

#to_human_stringsArray<String>

Render the failed match in a presentable way.

Prefer using render_mismatch over this method. It is left for backwards compatibility for test suites that expect it, but render_mismatch() will produce better output.

Returns:

  • (Array<String>)


136
137
138
# File 'assertions/match_result.rb', line 136

def to_human_strings()
  jsii_call_method("toHumanStrings", [])
end