@Test public void test_Should_Find_ApplicationTypeDocType_Valid() { final List<Object> preparedStatementValues = new ArrayList<>(); final DocumentTypeApplicationTypeGetRequest docNameGetRequest = Mockito.mock(DocumentTypeApplicationTypeGetRequest.class); final String queryString = "MyQuery"; when(docTypeAppTypeQueryBuilder.getQuery(docNameGetRequest, preparedStatementValues)).thenReturn(queryString); final List<DocumentTypeApplicationType> appTypeDocs = new ArrayList<>(); when(jdbcTemplate.query(queryString, preparedStatementValues.toArray(), docTypeAppliTypeRowMapper)) .thenReturn(appTypeDocs); assertTrue(appTypeDocs.equals(docTypeAppTypeRepository.findForCriteria(docNameGetRequest))); }
public List<DocumentTypeApplicationType> findForCriteria( final DocumentTypeApplicationTypeGetRequest docTypeAppliTypeGetRequest) { final List<Object> preparedStatementValues = new ArrayList<>(); try { if (docTypeAppliTypeGetRequest.getDocumentType() != null) docTypeAppliTypeGetRequest.setDocumentTypeId( jdbcTemplate.queryForObject(DocumentTypeApplicationTypeQueryBuilder.getDocumentTypeIdQuery(), new Object[] { docTypeAppliTypeGetRequest.getDocumentType(), docTypeAppliTypeGetRequest.getTenantId() }, Long.class)); } catch (final EmptyResultDataAccessException e) { log.info("EmptyResultDataAccessException: Query returned empty RS."); } final String queryStr = documentApplicationQueryBuilder.getQuery(docTypeAppliTypeGetRequest, preparedStatementValues); final List<DocumentTypeApplicationType> docTypeAppliTypes = jdbcTemplate.query(queryStr, preparedStatementValues.toArray(), documentTypeApplicationTypeRowMapper); return docTypeAppliTypes; }
DocumentTypeApplicationTypeRepository { public List<DocumentTypeApplicationType> findForCriteria( final DocumentTypeApplicationTypeGetRequest docTypeAppliTypeGetRequest) { final List<Object> preparedStatementValues = new ArrayList<>(); try { if (docTypeAppliTypeGetRequest.getDocumentType() != null) docTypeAppliTypeGetRequest.setDocumentTypeId( jdbcTemplate.queryForObject(DocumentTypeApplicationTypeQueryBuilder.getDocumentTypeIdQuery(), new Object[] { docTypeAppliTypeGetRequest.getDocumentType(), docTypeAppliTypeGetRequest.getTenantId() }, Long.class)); } catch (final EmptyResultDataAccessException e) { log.info("EmptyResultDataAccessException: Query returned empty RS."); } final String queryStr = documentApplicationQueryBuilder.getQuery(docTypeAppliTypeGetRequest, preparedStatementValues); final List<DocumentTypeApplicationType> docTypeAppliTypes = jdbcTemplate.query(queryStr, preparedStatementValues.toArray(), documentTypeApplicationTypeRowMapper); return docTypeAppliTypes; } }
DocumentTypeApplicationTypeRepository { public List<DocumentTypeApplicationType> findForCriteria( final DocumentTypeApplicationTypeGetRequest docTypeAppliTypeGetRequest) { final List<Object> preparedStatementValues = new ArrayList<>(); try { if (docTypeAppliTypeGetRequest.getDocumentType() != null) docTypeAppliTypeGetRequest.setDocumentTypeId( jdbcTemplate.queryForObject(DocumentTypeApplicationTypeQueryBuilder.getDocumentTypeIdQuery(), new Object[] { docTypeAppliTypeGetRequest.getDocumentType(), docTypeAppliTypeGetRequest.getTenantId() }, Long.class)); } catch (final EmptyResultDataAccessException e) { log.info("EmptyResultDataAccessException: Query returned empty RS."); } final String queryStr = documentApplicationQueryBuilder.getQuery(docTypeAppliTypeGetRequest, preparedStatementValues); final List<DocumentTypeApplicationType> docTypeAppliTypes = jdbcTemplate.query(queryStr, preparedStatementValues.toArray(), documentTypeApplicationTypeRowMapper); return docTypeAppliTypes; }  }
DocumentTypeApplicationTypeRepository { public List<DocumentTypeApplicationType> findForCriteria( final DocumentTypeApplicationTypeGetRequest docTypeAppliTypeGetRequest) { final List<Object> preparedStatementValues = new ArrayList<>(); try { if (docTypeAppliTypeGetRequest.getDocumentType() != null) docTypeAppliTypeGetRequest.setDocumentTypeId( jdbcTemplate.queryForObject(DocumentTypeApplicationTypeQueryBuilder.getDocumentTypeIdQuery(), new Object[] { docTypeAppliTypeGetRequest.getDocumentType(), docTypeAppliTypeGetRequest.getTenantId() }, Long.class)); } catch (final EmptyResultDataAccessException e) { log.info("EmptyResultDataAccessException: Query returned empty RS."); } final String queryStr = documentApplicationQueryBuilder.getQuery(docTypeAppliTypeGetRequest, preparedStatementValues); final List<DocumentTypeApplicationType> docTypeAppliTypes = jdbcTemplate.query(queryStr, preparedStatementValues.toArray(), documentTypeApplicationTypeRowMapper); return docTypeAppliTypes; }  DocumentTypeApplicationTypeReq create(
            final DocumentTypeApplicationTypeReq docTypeAppliTypeRequest); DocumentTypeApplicationTypeReq update(
            final DocumentTypeApplicationTypeReq docTypeAppliTypeRequest); List<DocumentTypeApplicationType> findForCriteria(
            final DocumentTypeApplicationTypeGetRequest docTypeAppliTypeGetRequest); boolean checkDocumentTypeApplicationTypeExist(final String code, final String applicationType,
            final String documentType, final String tenantId); boolean checkDocumentTypeExists(final String documentType, final String tenantId); }
DocumentTypeApplicationTypeRepository { public List<DocumentTypeApplicationType> findForCriteria( final DocumentTypeApplicationTypeGetRequest docTypeAppliTypeGetRequest) { final List<Object> preparedStatementValues = new ArrayList<>(); try { if (docTypeAppliTypeGetRequest.getDocumentType() != null) docTypeAppliTypeGetRequest.setDocumentTypeId( jdbcTemplate.queryForObject(DocumentTypeApplicationTypeQueryBuilder.getDocumentTypeIdQuery(), new Object[] { docTypeAppliTypeGetRequest.getDocumentType(), docTypeAppliTypeGetRequest.getTenantId() }, Long.class)); } catch (final EmptyResultDataAccessException e) { log.info("EmptyResultDataAccessException: Query returned empty RS."); } final String queryStr = documentApplicationQueryBuilder.getQuery(docTypeAppliTypeGetRequest, preparedStatementValues); final List<DocumentTypeApplicationType> docTypeAppliTypes = jdbcTemplate.query(queryStr, preparedStatementValues.toArray(), documentTypeApplicationTypeRowMapper); return docTypeAppliTypes; }  DocumentTypeApplicationTypeReq create(
            final DocumentTypeApplicationTypeReq docTypeAppliTypeRequest); DocumentTypeApplicationTypeReq update(
            final DocumentTypeApplicationTypeReq docTypeAppliTypeRequest); List<DocumentTypeApplicationType> findForCriteria(
            final DocumentTypeApplicationTypeGetRequest docTypeAppliTypeGetRequest); boolean checkDocumentTypeApplicationTypeExist(final String code, final String applicationType,
            final String documentType, final String tenantId); boolean checkDocumentTypeExists(final String documentType, final String tenantId);  }