@Test public void test_movement_repository_should_return_movements() { Movement movement1 = new Movement(); Movement movement2 = new Movement(); workFlowDetails = new WorkFlowDetails(); movement1.setId(1L); movement1.setEmployeeId(1L); movement1.setTypeOfMovement(TypeOfMovement.PROMOTION); movement1.setWorkflowDetails(workFlowDetails); movement2.setId(2L); movement2.setEmployeeId(2L); movement2.setTypeOfMovement(TypeOfMovement.TRANSFER); movement2.setWorkflowDetails(workFlowDetails); movements = new ArrayList<>(); movements.add(movement1); movements.add(movement2); when(movementQueryBuilder.getQuery(Mockito.any(MovementSearchRequest.class), Mockito.anyList(), Mockito.any(RequestInfo.class))) .thenReturn(""); when(documentsRepository.findByMovementId(Mockito.anyLong(), Mockito.anyString())).thenReturn(new ArrayList<>()); when(jdbcTemplate.query(Mockito.anyString(), Mockito.any(Object[].class), Mockito.any(MovementRowMapper.class))) .thenReturn(movements); final MovementSearchRequest movementSearchRequest = new MovementSearchRequest(); final RequestInfo requestInfo = new RequestInfo(); final List<Movement> response = movementRepository.findForCriteria(movementSearchRequest, requestInfo); assertEquals(movements.size(), response.size()); }
public List<Movement> findForCriteria(final MovementSearchRequest movementSearchRequest, final RequestInfo requestInfo) { final List<Object> preparedStatementValues = new ArrayList<>(); final String queryStr = movementQueryBuilder.getQuery(movementSearchRequest, preparedStatementValues, requestInfo); return jdbcTemplate.query(queryStr, preparedStatementValues.toArray(), movementRowMapper); }
MovementRepository { public List<Movement> findForCriteria(final MovementSearchRequest movementSearchRequest, final RequestInfo requestInfo) { final List<Object> preparedStatementValues = new ArrayList<>(); final String queryStr = movementQueryBuilder.getQuery(movementSearchRequest, preparedStatementValues, requestInfo); return jdbcTemplate.query(queryStr, preparedStatementValues.toArray(), movementRowMapper); } }
MovementRepository { public List<Movement> findForCriteria(final MovementSearchRequest movementSearchRequest, final RequestInfo requestInfo) { final List<Object> preparedStatementValues = new ArrayList<>(); final String queryStr = movementQueryBuilder.getQuery(movementSearchRequest, preparedStatementValues, requestInfo); return jdbcTemplate.query(queryStr, preparedStatementValues.toArray(), movementRowMapper); }  }
MovementRepository { public List<Movement> findForCriteria(final MovementSearchRequest movementSearchRequest, final RequestInfo requestInfo) { final List<Object> preparedStatementValues = new ArrayList<>(); final String queryStr = movementQueryBuilder.getQuery(movementSearchRequest, preparedStatementValues, requestInfo); return jdbcTemplate.query(queryStr, preparedStatementValues.toArray(), movementRowMapper); }  List<Movement> findForCriteria(final MovementSearchRequest movementSearchRequest,
			final RequestInfo requestInfo); MovementRequest saveMovement(final MovementRequest movementRequest); Movement updateMovement(final MovementRequest movementRequest); List<Movement> findForExistingMovement(final Movement movement, final RequestInfo requestInfo); Long generateSequence(); }
MovementRepository { public List<Movement> findForCriteria(final MovementSearchRequest movementSearchRequest, final RequestInfo requestInfo) { final List<Object> preparedStatementValues = new ArrayList<>(); final String queryStr = movementQueryBuilder.getQuery(movementSearchRequest, preparedStatementValues, requestInfo); return jdbcTemplate.query(queryStr, preparedStatementValues.toArray(), movementRowMapper); }  List<Movement> findForCriteria(final MovementSearchRequest movementSearchRequest,
			final RequestInfo requestInfo); MovementRequest saveMovement(final MovementRequest movementRequest); Movement updateMovement(final MovementRequest movementRequest); List<Movement> findForExistingMovement(final Movement movement, final RequestInfo requestInfo); Long generateSequence(); static final Logger LOGGER; }