Skip to content

Instantly share code, notes, and snippets.

@mstrejczek
Created June 10, 2014 23:36
@When("I put a message on the queue")
public void putMessageOnQueue() throws InterruptedException {
log.info(">>> When: I put a message on the queue");
jmsTemplate.send("TEST.QUEUE", new MessageCreator() {
@Override
public Message createMessage(final Session session) throws JMSException {
return session.createTextMessage("!!!test");
}
});
TimeUnit.SECONDS.sleep(3);
}
@When("processing is set to fail")
public void injectProcessingFailure() {
log.info(">>> When: processing is set to fail");
ThrowExceptionAspectBean exceptionInjector = (ThrowExceptionAspectBean)ac.getBean("throwExceptionAspectBean");
exceptionInjector.setExceptionFlag(true);
}
@Then("value is stored in database")
public void checkMessageStoredInDatabase() {
log.info(">>> Then: value is stored in database");
assertEquals(1, SimpleJdbcTestUtils.countRowsInTable(new SimpleJdbcTemplate(jdbcTemplate), "message"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment