### Question:
ClusterLockManager implements GroupTopicListener<ClusterLockManager.ClusterLockMessage>, GroupMembershipListener, LockManager { ClusterLock generateLockEngine(String lockName) { AtomicState<ClusterLock> stateStorage = currentLocks.binding( lockName ); StateFactory<ClusterLock> lockFactory = lockFactoryBinder.createFactory(lockName); Lock membershipSharedLock = clusterMembershipLock.readLock(); LazyLockState lazyState = new LazyLockState(lockFactory,stateStorage,membershipSharedLock); StateEngine<ClusterLock> engine = new StateEngine<ClusterLock>( lockName, ClusterLock.class , lazyState ); return engine.getProxy(ClusterLock.class); } ClusterLockManager(CoordinationServices memberTracker);  ClusterLockManager(MonotonicLongClock clock, MembershipViewSource memberTracker, GroupTopic<ClusterLockMessage> topic);   ClusterLockManager(MembershipViewSource memberTracker, GroupTopic<ClusterLockMessage> topic, LockFactoryBinder<ClusterLock> lockFactoryBinder, ReadWriteLock clusterMembershipLock, ConcurrentReferenceMap<String, ClusterLock> currentLocks); void onStart(); ClusterLock getClusterLock(String lockName); ReadWriteLock getReadWriteLock(final String lockName); @Override void onMembershipEvent(MembershipEventType eventType, InetSocketAddress inetSocketAddress); @Override void onMessage(ClusterLockMessage message); @Override AcquiredLock acquire(LockClient client, LockSpecification spec, LockType type); @Override void release(AcquiredLock al); @Override String assertNoLocks(); @Override IntermediateResultSet showState(); void shutdown();  }### Answer:
@Test public void testGenerateLockEngine() throws Exception { ClusterLockManager mgr = new ClusterLockManager(memberTracker,topic,lockFactoryBinder,clusterMembershipLock,currentLocks); final String lockName = "myLockName"; jmock.checking( new Expectations() {{ oneOf(currentLocks).binding(lockName);will(returnValue(mapStoredState)); oneOf(lockFactoryBinder).createFactory(lockName);will(returnValue(boundLockFactory)); oneOf(clusterMembershipLock).readLock();will(returnValue(readLock)); }}); ClusterLock proxy = mgr.generateLockEngine(lockName); assertNotNull(proxy); }