WARNING: This server is unstable and will be retired in the next days.
If you want to keep this forum available, please request immediately a migration
on the
Nabble Support forum.
Forums that don't receive any migration request will be deleted forever.
Re: Creating multiple instances of a mock object
Sorted. Thanks. Vince.
(On chapter 6 of GOOS;)
---------------------------------------------------------------------------------------------------
JMock enforces that multiple mock instances of the same type should have different names. That's what the error message is saying. Normally the instance name is defaulted. You could try:
final Subscriber subscriber1 = context.mock(Subscriber.class, "first");
final Subscriber subscriber2 = context.mock(Subscriber.class, "second");
final Subscriber subscriber3 = context.mock(Subscriber.class, "third");
S.