Is it possible to create a mock object that implements several interfaces with EasyMock?
For example, interface Foo and interface Closeable
Another way to solve this problem is to use a CGLib mixin:
final Interface1 interface1 = mockery.mock(Interface1.class);
final Interface2 interface2 = mockery.mock(Interface2.class);
service.setDependence(Mixin.create(new Object[]{ interface1, interface2 }));
mockery.checking(new Expectations(){{
oneOf(interface1).doSomething();
oneOf(interface2).doNothing();
}});
service.execute();
Whether or not this is a good idea, it's something up to discussion...