CloudWatchStepDefinitions { @Then("^assertCW alarm is on$") public boolean isAlarmOn() { if (alarmName != null) { return cloudWatchRaider.isStateInAlarm(alarmName); } throw new RuntimeException("Alarm Name is not set"); } CloudWatchStepDefinitions(); ExecutionStateCache getExecutionStateCache(); void setExecutionStateCache(ExecutionStateCache executionStateCache); @Given("^CloudWatch Alarm \"([^\"]*)\"$") CloudWatchStepDefinitions givenAnAlarmName(String alarmName); @Then("^assertCW alarm = \"([^\"]*)\"$") void assertCloudWatchAlarmState(String expectedState); @Then("^assertCW alarm \"([^\"]*)\" = \"([^\"]*)\"$") void assertCloudWatchAlarmState(String alarm, String expectedState); @Then("^assertCW alarm is on$") boolean isAlarmOn(); @Then("^assertCW alarm is off$") boolean isAlarmOff(); @Given("^check CloudWatch alarms state$") CloudWatchStepDefinitions checkAlarmState();  }
@Test public void testIsAlarmOn() { cloudWatchStepDefinitions.givenAnAlarmName("alarmName"); PowerMockito.when(cloudWatchRaider.getAlarmState("alarmName")).thenReturn("OK"); cloudWatchStepDefinitions.isAlarmOn(); }