@org.junit.Test public void notifiesListenerBeforeTest() { final TestClosure closure = context.mock(TestClosure.class); test.beforeTest(HelperUtil.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 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); }