### Question:
RequestExecutorFactory { QueryRequestExecutor create(QueryRequest queryRequest){ QueryRequestExecutor executor; if (!queryRequest.isPaged()) { executor = new QueryRequestNonPagedExecutor(queryRequest); } else { executor = new QueryRequestPagedExecutor(queryRequest); } return executor; }    }### Answer:
@Test public void testPagedExecutorCreated() { when(queryRequest.isPaged()).thenReturn(true); when(queryRequest.getSearchText()).thenReturn("(l=TLV)"); QueryRequestExecutor executor = requestExecutorFactory.create(queryRequest); assertTrue(executor instanceof QueryRequestPagedExecutor); }
@Test public void testNonPagedExecutorCreated() { when(queryRequest.isPaged()).thenReturn(false); when(queryRequest.getSearchText()).thenReturn("(l=TLV)"); QueryRequestExecutor executor = requestExecutorFactory.create(queryRequest); assertTrue(executor instanceof QueryRequestNonPagedExecutor); }