@Test @Sql(scripts = {"/sql/clearCity.sql", "/sql/clearTenant.sql", "/sql/insertTenantData.sql"}) public void test_should_return_zero_when_tenant_does_not_exist_for_the_given_tenantCode() throws Exception { Long count = tenantRepository.isTenantPresent("NON.EXISTENT"); assertThat(count).isEqualTo(0L); }
public Long isTenantPresent(String tenantCode) { final Map<String, Object> parameterMap = new HashMap<String, Object>() {{ put(Tenant.CODE, tenantCode); }}; SqlRowSet sqlRowSet = namedParameterJdbcTemplate.queryForRowSet(COUNT_WITH_TENANT_CODE_QUERY, parameterMap); sqlRowSet.next(); return sqlRowSet.getLong("count"); }
TenantRepository { public Long isTenantPresent(String tenantCode) { final Map<String, Object> parameterMap = new HashMap<String, Object>() {{ put(Tenant.CODE, tenantCode); }}; SqlRowSet sqlRowSet = namedParameterJdbcTemplate.queryForRowSet(COUNT_WITH_TENANT_CODE_QUERY, parameterMap); sqlRowSet.next(); return sqlRowSet.getLong("count"); } }
TenantRepository { public Long isTenantPresent(String tenantCode) { final Map<String, Object> parameterMap = new HashMap<String, Object>() {{ put(Tenant.CODE, tenantCode); }}; SqlRowSet sqlRowSet = namedParameterJdbcTemplate.queryForRowSet(COUNT_WITH_TENANT_CODE_QUERY, parameterMap); sqlRowSet.next(); return sqlRowSet.getLong("count"); } TenantRepository(CityRepository cityRepository, NamedParameterJdbcTemplate namedParameterJdbcTemplate); }
TenantRepository { public Long isTenantPresent(String tenantCode) { final Map<String, Object> parameterMap = new HashMap<String, Object>() {{ put(Tenant.CODE, tenantCode); }}; SqlRowSet sqlRowSet = namedParameterJdbcTemplate.queryForRowSet(COUNT_WITH_TENANT_CODE_QUERY, parameterMap); sqlRowSet.next(); return sqlRowSet.getLong("count"); } TenantRepository(CityRepository cityRepository, NamedParameterJdbcTemplate namedParameterJdbcTemplate); List<org.egov.tenant.domain.model.Tenant> find(TenantSearchCriteria tenantSearchCriteria); @Transactional org.egov.tenant.domain.model.Tenant save(final org.egov.tenant.domain.model.Tenant tenant); @Transactional org.egov.tenant.domain.model.Tenant update(final org.egov.tenant.domain.model.Tenant tenant); Long isTenantPresent(String tenantCode); }
TenantRepository { public Long isTenantPresent(String tenantCode) { final Map<String, Object> parameterMap = new HashMap<String, Object>() {{ put(Tenant.CODE, tenantCode); }}; SqlRowSet sqlRowSet = namedParameterJdbcTemplate.queryForRowSet(COUNT_WITH_TENANT_CODE_QUERY, parameterMap); sqlRowSet.next(); return sqlRowSet.getLong("count"); } TenantRepository(CityRepository cityRepository, NamedParameterJdbcTemplate namedParameterJdbcTemplate); List<org.egov.tenant.domain.model.Tenant> find(TenantSearchCriteria tenantSearchCriteria); @Transactional org.egov.tenant.domain.model.Tenant save(final org.egov.tenant.domain.model.Tenant tenant); @Transactional org.egov.tenant.domain.model.Tenant update(final org.egov.tenant.domain.model.Tenant tenant); Long isTenantPresent(String tenantCode);  }