@org.junit.Test public void notifiesListenerOfEvents() { final TestListener listener = context.mock(TestListener.class); test.addTestListener(listener); final TestDescriptor testDescriptor = context.mock(TestDescriptor.class); context.checking( new Expectations() { { one(listener).beforeSuite(testDescriptor); } }); test.getTestListenerBroadcaster().getSource().beforeSuite(testDescriptor); }
@org.junit.Test public void notifiesListenerBeforeTest() { final TestClosure closure = context.mock(TestClosure.class); test.beforeTest(TestUtil.toClosure(closure)); final TestDescriptor testDescriptor = context.mock(TestDescriptor.class); context.checking( new Expectations() { { one(closure).call(testDescriptor); } }); test.getTestListenerBroadcaster().getSource().beforeTest(testDescriptor); }
@org.junit.Test public void notifiesListenerAfterTest() { final TestClosure closure = context.mock(TestClosure.class); test.afterTest(HelperUtil.toClosure(closure)); final TestDescriptor testDescriptor = context.mock(TestDescriptor.class); final TestResult result = context.mock(TestResult.class); context.checking( new Expectations() { { one(closure).call(testDescriptor); } }); test.getTestListenerBroadcaster().getSource().afterTest(testDescriptor, result); }