@Test public void should_send_mail_when_parameters_are_correct() { final EmailBuilder email = context.mock(EmailBuilder.class); context.checking( new Expectations() { { one(email).from("*****@*****.**"); will(returnValue(email)); one(email).to("*****@*****.**"); will(returnValue(email)); one(email).withSubject("subject"); will(returnValue(email)); one(email).withBody("body"); will(returnValue(email)); one(email).withCharset("UTF-8"); will(returnValue(email)); one(email).send(); } }); email .from("*****@*****.**") .to("*****@*****.**") .withSubject("subject") .withBody("body") .withCharset("UTF-8") .send(); }