When using with jmock 2.5.1 mockery method assertIsSatisfied() is not
called automatically after the test.
Please see the code below. It passes if checkMockery method is removed from
the test.
import javax.management.MBeanServer;
import javax.management.ObjectName;
import atunit.AtUnit;
import atunit.Mock;
import atunit.MockFramework;
import atunit.Stub;
import atunit.Unit;
import static org.hamcrest.CoreMatchers.equalTo;
import org.jmock.Expectations;
import org.jmock.Mockery;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(AtUnit.class)
@MockFramework(MockFramework.Option.JMOCK)
public class CallStatisticsJMXExporterTest{
Mockery ctx;
@Stub CallRegistry callRegistry;
@Mock MBeanServer mBeanServer;
@Unit CallStatisticsJMXExporter callStatisticsJMXExporter;
@Before
public void setUp(){
callStatisticsJMXExporter = new
CallStatisticsJMXExporter(callRegistry, mBeanServer);
}
@After public void checkMockery(){
ctx.assertIsSatisfied();
}
@Test
public void mbeanIsRegistered() throws Exception{
ctx.checking(new Expectations(){{
one(mBeanServer).registerMBean(with(any(Object.class)), with(
equalTo( new ObjectName("object:method=method1"))));
}});
callStatisticsJMXExporter.export(new CallKey("object", "method1"));
}
}
public class CallStatisticsJMXExporter{
public CallStatisticsJMXExporter(CallRegistry inMemoryCallRegistry,
MBeanServer platformMBeanServer){
}
public void export(CallKey callKey){
}
}
Original issue reported on code.google.com by piot...@gmail.com on 28 Oct 2008 at 12:40
Original issue reported on code.google.com by
piot...@gmail.com
on 28 Oct 2008 at 12:40