### Question:
SlaveLocksClient implements Locks.Client { @Override public void stop() { client.stop(); stopLockSessionOnMaster(); stopped = true; } 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 stopDoesNotThrowWhenMasterCommunicationThrowsComException() { ComException error = new ComException( "Communication failure" ); when( master.endLockSession( isNull(), anyBoolean() ) ).thenThrow( error ); client.stop(); logProvider.assertExactly( inLog( SlaveLocksClient.class ) .warn( equalTo( "Unable to stop lock session on master" ), CoreMatchers.instanceOf( DistributedLockFailureException.class ) ) ); }
@Test public void stopDoesNotThrowWhenMasterCommunicationThrows() { RuntimeException error = new IllegalArgumentException( "Wrong params" ); when( master.endLockSession( isNull(), anyBoolean() ) ).thenThrow( error ); client.stop(); logProvider.assertExactly( inLog( SlaveLocksClient.class ) .warn( equalTo( "Unable to stop lock session on master" ), CoreMatchers.equalTo( error ) ) ); }