/** * Test failed consumer start. * * @throws SchedulerException */ @Test(expected = RuntimeException.class) public void test_failed_start_due_to_parserException() throws SchedulerException { final JobKey jobKey = new JobKey("flowName", "moduleName"); // expectations mockery.checking( new Expectations() { { // get flow and module name from the job exactly(1).of(mockJobDetail).getKey(); will(returnValue(jobKey)); // access configuration for details exactly(1).of(consumerConfiguration).getCronExpression(); will(returnValue("* * * * ? ?")); // schedule the job exactly(1).of(scheduler).scheduleJob(mockJobDetail, trigger); will(throwException(new ParseException("test", 0))); } }); ScheduledConsumer scheduledConsumer = new StubbedScheduledConsumer(scheduler); scheduledConsumer.setConfiguration(consumerConfiguration); scheduledConsumer.start(); mockery.assertIsSatisfied(); }