src/test/java/com/digitalglobe/util/maven/plugin/TestCloudFormationDeploy.java
/**
         * Use this method to determine if a stack exists and to get information about the stack for this mocking
         * scenario.  The mock of this method validates that you are looking for the stack in this mock.  It uses
         * a static class with with a create flag to signal if the current test is testing create or update.  In the
         * create scenario it will throw an exception indicating that the stack does not exist.  In the update
         * scenario it will return a result object.
         *
         * @param describeStacksRequest is a request containing the name of the stack to lookup.
         * @return a result indicating the properties of the existing stack.
         */
Use this method to determine if a stack exists and to get information about the stack for this mocking
scenario.  The mock of this method validates that you are looking for the stack in this mock.  It uses
a static class with with a create flag to signal if the current test is testing create or update.  In the
create scenario it will throw an exception indicating that the stack does not exist.  In the update
scenario it will return a result object.

@param describeStacksRequest is a request containing the name of the stack to lookup.
@return a result indicating the properties of the existing stack.
Use this method to determine if a stack exists and to get information about the stack for this mocking scenario . The mock of this method validates that you are looking for the stack in this mock . It uses a static class with with a create flag to signal if the current test is testing create or update . In the create scenario it will throw an exception indicating that the stack does not exist . In the update scenario it will return a result object . @param describeStacksRequest is a request containing the name of the stack to lookup . @return a result indicating the properties of the existing stack .
@Override
        public CompletableFuture<DescribeStacksResponse> describeStacks(DescribeStacksRequest describeStacksRequest) {
            return CompletableFuture.supplyAsync(() -> {
                try {Thread.sleep(500);}
                catch (InterruptedException e) {/*Ignore*/}
                if(StackScenario.createTest && !StackScenario.createTestComplete)
                    throw CloudFormationException.builder().message("Stack does not exist.").build();
                Collection<Output> outputs = new ArrayList<>();
                Output output = Output.builder().outputKey("HELLO").outputValue("World").build();
                outputs.add(output);
                Stack stack = Stack.builder().outputs(outputs).stackName("Test")
                        .stackStatus(StackStatus.CREATE_COMPLETE).build();
                ArrayList<Stack> stacks = new ArrayList<>();
                stacks.add(stack);
                return DescribeStacksResponse.builder().stacks(stacks).build();
            });
        }
@ Override public CompletableFuture < DescribeStacksResponse > describeStacks ( DescribeStacksRequest describeStacksRequest ) { return CompletableFuture . supplyAsync ( ( ) -> { try { Thread . sleep ( 500 ) ; } catch ( InterruptedException e ) { /*Ignore*/ } if ( StackScenario . createTest && ! StackScenario . createTestComplete ) throw CloudFormationException . builder ( ) . message ( "Stack does not exist." ) . build ( ) ; Collection < Output > outputs = new ArrayList < > ( ) ; Output output = Output . builder ( ) . outputKey ( "HELLO" ) . outputValue ( "World" ) . build ( ) ; outputs . add ( output ) ; Stack stack = Stack . builder ( ) . outputs ( outputs ) . stackName ( "Test" ) . stackStatus ( StackStatus . CREATE_COMPLETE ) . build ( ) ; ArrayList < Stack > stacks = new ArrayList < > ( ) ; stacks . add ( stack ) ; return DescribeStacksResponse . builder ( ) . stacks ( stacks ) . build ( ) ; } ) ; }
Use this method to determine if a stack exists and to get information about the stack for this mocking
 scenario.
Use this method to determine if a stack exists and to get information about the stack for this mocking scenario .