    @Test
    public void ensureStopped_GivenTimeoutWaitingForStopped_ShouldThrow() throws InterruptedException {

        Mockito.when(client.describeApplication(describeApplicationRequest))
            .thenReturn(withStatus(ApplicationStatus.STOPPING));
        try {
            manager.ensureStopped();
            Assert.fail("expected timeout waiting for application to finish starting");
        } catch (IllegalStateException expectedException) {
            // expected
        }
        Mockito.verify(client, Mockito.times(30))
            .describeApplication(describeApplicationRequest);
    }