### Question:
MasterImpl extends LifecycleAdapter implements Master { @Override public Response<LockResult> acquireSharedLock( RequestContext context, ResourceType type, long... resourceIds ) { assertCorrectEpoch( context ); Locks.Client session; try { session = conversationManager.acquire( context ).getLocks(); } catch ( NoSuchEntryException | ConcurrentAccessException e ) { return spi.packTransactionObligationResponse( context, new LockResult( LockStatus.NOT_LOCKED, "Unable to acquire shared lock: " + e.getMessage() ) ); } try { for ( long resourceId : resourceIds ) { session.acquireShared( LockTracer.NONE, type, resourceId ); } return spi.packTransactionObligationResponse( context, new LockResult( LockStatus.OK_LOCKED ) ); } catch ( DeadlockDetectedException e ) { return spi.packTransactionObligationResponse( context, new LockResult( LockStatus.DEAD_LOCKED, e.getMessage() ) ); } catch ( IllegalResourceException e ) { return spi.packTransactionObligationResponse( context, new LockResult( LockStatus.NOT_LOCKED, "Attempted to lock illegal resource: " + e.getMessage() ) ); } finally { conversationManager.release( context ); } } MasterImpl( SPI spi, ConversationManager conversationManager, Monitor monitor, Config config ); @Override void start(); @Override void stop(); @Override Response<IdAllocation> allocateIds( RequestContext context, IdType idType ); @Override Response<Long> commit( RequestContext context, TransactionRepresentation preparedTransaction ); @Override Response<Integer> createRelationshipType( RequestContext context, String name ); @Override Response<Integer> createPropertyKey( RequestContext context, String name ); @Override Response<Integer> createLabel( RequestContext context, String name ); @Override Response<Void> pullUpdates( RequestContext context ); @Override Response<HandshakeResult> handshake( long txId, StoreId storeId ); @Override Response<Void> copyStore( RequestContext requestContext, StoreWriter writer ); @Override Response<Void> newLockSession( RequestContext context ); @Override Response<Void> endLockSession( RequestContext context, boolean success ); @Override Response<LockResult> acquireExclusiveLock( RequestContext context, ResourceType type,
                                                      long... resourceIds ); @Override Response<LockResult> acquireSharedLock( RequestContext context, ResourceType type,
                                                   long... resourceIds ); Map<Integer, Collection<RequestContext>> getOngoingTransactions();  }### Answer:
@Test public void lockResultMustHaveMessageWhenAcquiringSharedLockWithoutConversation() throws Exception { MasterImpl.SPI spi = mockedSpi(); ConversationManager conversationManager = mock( ConversationManager.class ); Config config = config(); MasterImpl master = new MasterImpl( spi, conversationManager, null, config ); RequestContext context = createRequestContext( master ); when( conversationManager.acquire( context ) ).thenThrow( new NoSuchEntryException( "" ) ); master.acquireSharedLock( context, ResourceTypes.NODE, 1 ); ArgumentCaptor<LockResult> captor = ArgumentCaptor.forClass( LockResult.class ); verify( spi ).packTransactionObligationResponse( MockitoHamcrest.argThat( is( context ) ), captor.capture() ); assertThat( captor.getValue().getMessage(), is( not( nullValue() ) ) ); }