### Question:
WorkspaceLockManager { void lockNodeInRepository( JcrSession session, UUID nodeUuid, String lockOwner, boolean isDeep ) throws LockFailedException, RepositoryException { PropertyFactory propFactory = session.getExecutionContext().getPropertyFactory(); Property lockOwnerProp = propFactory.create(JcrLexicon.LOCK_OWNER, lockOwner); Property lockIsDeepProp = propFactory.create(JcrLexicon.LOCK_IS_DEEP, isDeep); Graph.Batch workspaceBatch = repositoryLockManager.createWorkspaceGraph(workspaceName, session.getExecutionContext()).batch(); workspaceBatch.set(lockOwnerProp, lockIsDeepProp).on(nodeUuid); if (isDeep) { workspaceBatch.lock(nodeUuid).andItsDescendants().withDefaultTimeout(); } else { workspaceBatch.lock(nodeUuid).only().withDefaultTimeout(); } workspaceBatch.execute(); } WorkspaceLockManager( ExecutionContext context,
                          RepositoryLockManager repositoryLockManager,
                          String workspaceName,
                          Path locksPath );   }### Answer:
@Test public void shouldCreateLockRequestWhenLockingNode() throws RepositoryException { String lockOwner = "testOwner"; boolean isDeep = false; JcrSession session = mock(JcrSession.class); when(session.getExecutionContext()).thenReturn(context); workspaceLockManager.lockNodeInRepository(session, validUuid, lockOwner, isDeep); assertNextRequestIsLock(validLocation, LockScope.SELF_ONLY, 0); }