jetbrains-core/tst/software/aws/toolkits/jetbrains/services/cloudformation/CreateWaiterTest.kt [112:183]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - .build() ) val finalResponse = DescribeStacksResponse.builder() .stacks( Stack.builder() .stackName(stackName) .stackStatus(status) .build() ) .build() val firstResponse = if (times <= 0) finalResponse else inProgressResponseBuilder.build() if (times > 0) { repeat(times - 1) { responses.add(inProgressResponseBuilder.build()) } responses.add(finalResponse) } whenever( describeStacks( DescribeStacksRequest.builder() .stackName(stackName) .build() ) ).thenReturn(firstResponse, *responses.toTypedArray()) } private fun CloudFormationClient.stackThrowValidationError(stackName: String, times: Int) { val responses = mutableListOf() val inProgressResponseBuilder = DescribeStacksResponse.builder() .stacks( Stack.builder() .stackName(stackName) .stackStatus(StackStatus.CREATE_IN_PROGRESS) .build() ) val finalResponse = CloudFormationException.builder() .awsErrorDetails( AwsErrorDetails.builder() .errorCode("ValidationError") .build() ) .build() if (times <= 0) { whenever( describeStacks( DescribeStacksRequest.builder() .stackName(stackName) .build() ) ).thenThrow(finalResponse) } else { repeat(times - 1) { responses.add(inProgressResponseBuilder.build()) } whenever( describeStacks( DescribeStacksRequest.builder() .stackName(stackName) .build() ) ).thenReturn(inProgressResponseBuilder.build(), *responses.toTypedArray()) .thenThrow(finalResponse) } } companion object { private val DEFAULT_DELAY = Duration.ofMillis(5) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - jetbrains-core/tst/software/aws/toolkits/jetbrains/services/cloudformation/UpdateWaiterTest.kt [97:168]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - .build() ) val finalResponse = DescribeStacksResponse.builder() .stacks( Stack.builder() .stackName(stackName) .stackStatus(status) .build() ) .build() val firstResponse = if (times <= 0) finalResponse else inProgressResponseBuilder.build() if (times > 0) { repeat(times - 1) { responses.add(inProgressResponseBuilder.build()) } responses.add(finalResponse) } whenever( describeStacks( DescribeStacksRequest.builder() .stackName(stackName) .build() ) ).thenReturn(firstResponse, *responses.toTypedArray()) } private fun CloudFormationClient.stackThrowValidationError(stackName: String, times: Int) { val responses = mutableListOf() val inProgressResponseBuilder = DescribeStacksResponse.builder() .stacks( Stack.builder() .stackName(stackName) .stackStatus(StackStatus.CREATE_IN_PROGRESS) .build() ) val finalResponse = CloudFormationException.builder() .awsErrorDetails( AwsErrorDetails.builder() .errorCode("ValidationError") .build() ) .build() if (times <= 0) { whenever( describeStacks( DescribeStacksRequest.builder() .stackName(stackName) .build() ) ).thenThrow(finalResponse) } else { repeat(times - 1) { responses.add(inProgressResponseBuilder.build()) } whenever( describeStacks( DescribeStacksRequest.builder() .stackName(stackName) .build() ) ).thenReturn(inProgressResponseBuilder.build(), *responses.toTypedArray()) .thenThrow(finalResponse) } } companion object { private val DEFAULT_DELAY = Duration.ofMillis(5) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -