### Question:
SlaveLocksClient implements Locks.Client { @Override public void acquireShared( LockTracer tracer, ResourceType resourceType, long... resourceIds ) throws AcquireLockTimeoutException { assertNotStopped(); long[] newResourceIds = firstTimeSharedLocks( resourceType, resourceIds ); if ( newResourceIds.length > 0 ) { try { acquireSharedOnMasterFiltered( tracer, resourceType, newResourceIds ); } catch ( Throwable failure ) { if ( resourceIds != newResourceIds ) { releaseShared( resourceType, resourceIds, newResourceIds ); } throw failure; } for ( long resourceId : newResourceIds ) { if ( !client.trySharedLock( resourceType, resourceId ) ) { throw new LocalDeadlockDetectedException( client, localLockManager, resourceType, resourceId, READ ); } } } } SlaveLocksClient( Master master, Locks.Client local, Locks localLockManager,
            RequestContextFactory requestContextFactory, AvailabilityGuard availabilityGuard, LogProvider logProvider ); @Override void acquireShared( LockTracer tracer, ResourceType resourceType, long... resourceIds ); @Override void acquireExclusive( LockTracer tracer, ResourceType resourceType, long... resourceIds ); @Override boolean tryExclusiveLock( ResourceType resourceType, long resourceId ); @Override boolean trySharedLock( ResourceType resourceType, long resourceId ); @Override boolean reEnterShared( ResourceType resourceType, long resourceId ); @Override boolean reEnterExclusive( ResourceType resourceType, long resourceId ); @Override void releaseShared( ResourceType resourceType, long... resourceIds ); @Override void releaseExclusive( ResourceType resourceType, long... resourceIds ); @Override void prepare(); @Override void stop(); @Override void close(); @Override int getLockSessionId(); @Override Stream<? extends ActiveLock> activeLocks(); @Override long activeLockCount();  }### Answer:
@Test public void shouldNotTakeSharedLockOnMasterIfWeAreAlreadyHoldingSaidLock() { client.acquireShared( LockTracer.NONE, NODE, 1 ); client.acquireShared( LockTracer.NONE, NODE, 1 ); verify( master ).acquireSharedLock( null, NODE, 1 ); }
@Test( expected = DistributedLockFailureException.class ) public void mustThrowIfStartingNewLockSessionOnMasterThrowsComException() throws Exception { when( master.newLockSession( isNull() ) ).thenThrow( new ComException() ); client.acquireShared( LockTracer.NONE, NODE, 1 ); }
@Test( expected = DistributedLockFailureException.class ) public void mustThrowIfStartingNewLockSessionOnMasterThrowsTransactionFailureException() throws Exception { when( master.newLockSession( isNull() ) ).thenThrow( new TransactionFailureException( Status.General.DatabaseUnavailable, "Not now" ) ); client.acquireShared( LockTracer.NONE, NODE, 1 ); }
@Test( expected = DistributedLockFailureException.class ) public void acquireSharedMustThrowIfMasterThrows() { whenMasterAcquireShared().thenThrow( new ComException() ); client.acquireShared( LockTracer.NONE, NODE, 1 ); }
@Test public void acquireSharedFailsWhenClientStopped() { SlaveLocksClient client = stoppedClient(); try { client.acquireShared( LockTracer.NONE, NODE, 1 ); } catch ( Exception e ) { assertThat( e, instanceOf( LockClientStoppedException.class ) ); } }
@Test public void acquireSharedFailsWhenClientClosed() { SlaveLocksClient client = closedClient(); try { client.acquireShared( LockTracer.NONE, NODE, 1 ); } catch ( Exception e ) { assertThat( e, instanceOf( LockClientStoppedException.class ) ); } }