@Test public void getQueryWithTenantIdTest() { final List<Object> preparedStatementValues = new ArrayList<>(); Mockito.doReturn("500").when(applicationProperties).getSearchPageSizeDefault(); final String expectedQueryWithTenantId = "SELECT objectname,code,name,description,tenantid,createdby,createddate,lastmodifiedby," + "lastmodifieddate FROM egasset_statuses as status WHERE status.tenantId = ?"; final AssetStatusCriteria assetStatusCriteria = AssetStatusCriteria.builder().tenantId("ap.kurnool").build(); assertEquals(expectedQueryWithTenantId, assetStatusQueryBuilder.getQuery(assetStatusCriteria, preparedStatementValues)); final List<Object> expectedPreparedStatementValues = new ArrayList<>(); expectedPreparedStatementValues.add("ap.kurnool"); assertTrue(preparedStatementValues.equals(expectedPreparedStatementValues)); }
public String getQuery(final AssetStatusCriteria assetStatusCriteria, final List<Object> preparedStatementValues) { final StringBuilder selectQuery = new StringBuilder(BASE_QUERY); log.info("get query"); addWhereClause(selectQuery, preparedStatementValues, assetStatusCriteria); log.info("Query from asset status querybuilder for search : " + selectQuery); return selectQuery.toString(); }
AssetStatusQueryBuilder { public String getQuery(final AssetStatusCriteria assetStatusCriteria, final List<Object> preparedStatementValues) { final StringBuilder selectQuery = new StringBuilder(BASE_QUERY); log.info("get query"); addWhereClause(selectQuery, preparedStatementValues, assetStatusCriteria); log.info("Query from asset status querybuilder for search : " + selectQuery); return selectQuery.toString(); } }
AssetStatusQueryBuilder { public String getQuery(final AssetStatusCriteria assetStatusCriteria, final List<Object> preparedStatementValues) { final StringBuilder selectQuery = new StringBuilder(BASE_QUERY); log.info("get query"); addWhereClause(selectQuery, preparedStatementValues, assetStatusCriteria); log.info("Query from asset status querybuilder for search : " + selectQuery); return selectQuery.toString(); }  }
AssetStatusQueryBuilder { public String getQuery(final AssetStatusCriteria assetStatusCriteria, final List<Object> preparedStatementValues) { final StringBuilder selectQuery = new StringBuilder(BASE_QUERY); log.info("get query"); addWhereClause(selectQuery, preparedStatementValues, assetStatusCriteria); log.info("Query from asset status querybuilder for search : " + selectQuery); return selectQuery.toString(); }  String getQuery(final AssetStatusCriteria assetStatusCriteria, final List<Object> preparedStatementValues); }
AssetStatusQueryBuilder { public String getQuery(final AssetStatusCriteria assetStatusCriteria, final List<Object> preparedStatementValues) { final StringBuilder selectQuery = new StringBuilder(BASE_QUERY); log.info("get query"); addWhereClause(selectQuery, preparedStatementValues, assetStatusCriteria); log.info("Query from asset status querybuilder for search : " + selectQuery); return selectQuery.toString(); }  String getQuery(final AssetStatusCriteria assetStatusCriteria, final List<Object> preparedStatementValues); public String BASE_QUERY; }