While keeping the old end-to-end test, create an interaction to verify the integration of BirthdayGreetingService and MessageSender:
@Test public void the_service_should_ask_the_messageSender() { final Email address = new Email("[email protected]"); final Employee john = new Employee(address); final MessageSender messageSender = mock(MessageSender.class); new BirthdayGreetingService(messageSender) .greet(john); verify(messageSender).send(address,
"Greetings on your birthday"); }
At this point, a new TweetMessageSender can be written, completing the last step of the algorithm.