@Generated(value="jsii-pacmak/1.30.0 (build adae23f)", date="2021-07-09T19:17:34.245Z") @Stability(value=Experimental) public class TemplateAssertions extends software.amazon.jsii.JsiiObject
Typically used, as part of unit tests, to validate that the rendered CloudFormation template has expected resources and properties.
| Modifier | Constructor and Description |
|---|---|
protected |
TemplateAssertions(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
TemplateAssertions(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
static TemplateAssertions |
fromStack(Stack stack)
(experimental) Base your assertions on the CloudFormation template synthesized by a CDK `Stack`.
|
static TemplateAssertions |
fromString(String template)
(experimental) Base your assertions from an existing CloudFormation template formatted as a string.
|
static TemplateAssertions |
fromTemplate(Map<String,? extends Object> template)
(experimental) Base your assertions from an existing CloudFormation template formatted as a nested set of records.
|
void |
hasResource(String type,
Object props)
(experimental) Assert that a resource of the given type and given definition exists in the CloudFormation template.
|
void |
hasResourceProperties(String type,
Object props)
(experimental) Assert that a resource of the given type and properties exists in the CloudFormation template.
|
void |
resourceCountIs(String type,
Number count)
(experimental) Assert that the given number of resources of the given type exist in the template.
|
void |
templateMatches(Map<String,Object> expected)
(experimental) Assert that the CloudFormation template matches the given value.
|
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetprotected TemplateAssertions(software.amazon.jsii.JsiiObjectRef objRef)
protected TemplateAssertions(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Experimental) @NotNull public static TemplateAssertions fromStack(@NotNull Stack stack)
stack - the CDK Stack to run assertions on. This parameter is required.@Stability(value=Experimental) @NotNull public static TemplateAssertions fromString(@NotNull String template)
template - the CloudFormation template in. This parameter is required.@Stability(value=Experimental) @NotNull public static TemplateAssertions fromTemplate(@NotNull Map<String,? extends Object> template)
template - the CloudFormation template formatted as a nested set of records. This parameter is required.@Stability(value=Experimental)
public void hasResource(@NotNull
String type,
@NotNull
Object props)
By default, performs partial matching on the resource, via the Match.objectLike().
To configure different behavour, use other matchers in the Match class.
type - the resource type;. This parameter is required.props - the entire defintion of the resource as should be expected in the template. This parameter is required.@Stability(value=Experimental)
public void hasResourceProperties(@NotNull
String type,
@NotNull
Object props)
By default, performs partial matching on the Properties key of the resource, via the
Match.objectLike(). To configure different behavour, use other matchers in the Match class.
type - the resource type;. This parameter is required.props - the 'Properties' section of the resource as should be expected in the template. This parameter is required.@Stability(value=Experimental)
public void resourceCountIs(@NotNull
String type,
@NotNull
Number count)
type - the resource type;. This parameter is required.count - number of expected instances. This parameter is required.@Stability(value=Experimental)
public void templateMatches(@NotNull
Map<String,Object> expected)
expected - the expected CloudFormation template as key-value pairs. This parameter is required.Copyright © 2021. All rights reserved.