import org.jmock.Expectations; import org.jmock.Mockery; import org.junit.Test; public class EmailServiceTest { @Test public void testSendEmail() { Mockery mockery = new Mockery(); final EmailService emailServiceMock = mockery.mock(EmailService.class); final Email email = new Email("recipient@example.com", "Hello", "Hello, World!"); mockery.checking(new Expectations() {{ oneOf(emailServiceMock).sendEmail(with(email)); }}); emailServiceMock.sendEmail(email); mockery.assertIsSatisfied(); } }


上一篇:
下一篇:
切换中文