DiceRollMessageProcessor implements MessageProcessor { @Override public void process(IncomeMessage message) { try { int points = diceRoll.roll(message.command().as(String.class)); message.reply("you got [v]%s[/v] points!", points); } catch (IllegalArgumentException e) { throw new MessageProcessingException(e.getMessage(), e); } } DiceRollMessageProcessor(DiceRoll diceRoll); @Override void process(IncomeMessage message);  }
@Test public void testProcess() { Spec.given(new DiceRollMessageProcessor(diceRoll)) .when(process(message)) .expect(the(message), to(receive(IncomeMessage::command))) .expect(the(message), to(receive(reply("you got [v]%s[/v] points!", expectedScore)))); }