@Test public void testApplicationNoQuery() { Mockito.doReturn("3").when(applicationProperties).marriageRegnSearchPageSizeDefault(); List<String> appNos = new ArrayList(); appNos.add("9"); appNos.add("10"); MarriageRegnCriteria marriageRegnCriteria = MarriageRegnCriteria.builder().tenantId("1") .applicationNumber(appNos).build(); List<Object> preparedStatementValues = new ArrayList(); String queryString = marriageRegnQueryBuilder.getQueryForListOfMarriageRegnIds(marriageRegnCriteria, preparedStatementValues); String expectedQueryString = "SELECT distinct mr.applicationnumber as mr_applicationnumber FROM egmr_marriage_regn mr" + " JOIN egmr_marrying_person mpbg ON mr.bridegroomid = mpbg.id AND mr.tenantid = mpbg.tenantid" + " JOIN egmr_marrying_person mpb ON mr.brideid = mpb.id AND mr.tenantid = mpb.tenantid" + " JOIN egmr_registration_unit ru ON mr.regnunitid = ru.id AND mr.tenantid = ru.tenantid" + " JOIN egmr_marriageregn_witness w ON mr.applicationnumber = w.applicationnumber" + " JOIN egmr_fee f ON f.id=mr.feeid" + " LEFT OUTER JOIN egmr_marriage_certificate mc ON mr.applicationnumber = mc.applicationnumber AND mr.tenantid = mc.tenantid" + " WHERE mr.tenantid = ? AND mr.applicationnumber IN ('9', '10') LIMIT ? OFFSET ?"; assertEquals(queryString, expectedQueryString); assertEquals((String) preparedStatementValues.get(0), "1"); assertEquals((long) preparedStatementValues.get(1), 3); assertEquals((long) preparedStatementValues.get(2), 0); }
public String getQueryForListOfMarriageRegnIds(MarriageRegnCriteria marriageRegnCriteria, List<Object> preparedStatementValues) { StringBuilder selectQuery = new StringBuilder(MARRIAGE_REGN_IDS_QUERY); addWhereClause(selectQuery, preparedStatementValues, marriageRegnCriteria, null); addPagingClause(selectQuery, preparedStatementValues, marriageRegnCriteria); logger.debug("marriage regn selectIdQuery : " + selectQuery); return selectQuery.toString(); }
MarriageRegnQueryBuilder { public String getQueryForListOfMarriageRegnIds(MarriageRegnCriteria marriageRegnCriteria, List<Object> preparedStatementValues) { StringBuilder selectQuery = new StringBuilder(MARRIAGE_REGN_IDS_QUERY); addWhereClause(selectQuery, preparedStatementValues, marriageRegnCriteria, null); addPagingClause(selectQuery, preparedStatementValues, marriageRegnCriteria); logger.debug("marriage regn selectIdQuery : " + selectQuery); return selectQuery.toString(); } }
MarriageRegnQueryBuilder { public String getQueryForListOfMarriageRegnIds(MarriageRegnCriteria marriageRegnCriteria, List<Object> preparedStatementValues) { StringBuilder selectQuery = new StringBuilder(MARRIAGE_REGN_IDS_QUERY); addWhereClause(selectQuery, preparedStatementValues, marriageRegnCriteria, null); addPagingClause(selectQuery, preparedStatementValues, marriageRegnCriteria); logger.debug("marriage regn selectIdQuery : " + selectQuery); return selectQuery.toString(); }  }
MarriageRegnQueryBuilder { public String getQueryForListOfMarriageRegnIds(MarriageRegnCriteria marriageRegnCriteria, List<Object> preparedStatementValues) { StringBuilder selectQuery = new StringBuilder(MARRIAGE_REGN_IDS_QUERY); addWhereClause(selectQuery, preparedStatementValues, marriageRegnCriteria, null); addPagingClause(selectQuery, preparedStatementValues, marriageRegnCriteria); logger.debug("marriage regn selectIdQuery : " + selectQuery); return selectQuery.toString(); }  String getQueryForListOfMarriageRegnIds(MarriageRegnCriteria marriageRegnCriteria,
			List<Object> preparedStatementValues); String getQuery(MarriageRegnCriteria marriageRegnCriteria, List<Object> preparedStatementValues,
			List<String> listOfApplNos); }
MarriageRegnQueryBuilder { public String getQueryForListOfMarriageRegnIds(MarriageRegnCriteria marriageRegnCriteria, List<Object> preparedStatementValues) { StringBuilder selectQuery = new StringBuilder(MARRIAGE_REGN_IDS_QUERY); addWhereClause(selectQuery, preparedStatementValues, marriageRegnCriteria, null); addPagingClause(selectQuery, preparedStatementValues, marriageRegnCriteria); logger.debug("marriage regn selectIdQuery : " + selectQuery); return selectQuery.toString(); }  String getQueryForListOfMarriageRegnIds(MarriageRegnCriteria marriageRegnCriteria,
			List<Object> preparedStatementValues); String getQuery(MarriageRegnCriteria marriageRegnCriteria, List<Object> preparedStatementValues,
			List<String> listOfApplNos);  }