@Test public void testcheckIdsAndTenantIdsFromDBForRegistrationUnit() { RegistrationUnit registrationUnit = getRegistrationUnit(); when(registrationUnitQueryBuilder.getSelectQuery(any(RegistrationUnitSearchCriteria.class))) .thenReturn(getQueryGenerator()); when(jdbcTemplate.queryForObject(any(String.class), any(), any(RegistrationUnitRowMapper.class))) .thenReturn(getRegistrationUnit()); registrationUnitRepository.checkIdsAndTenantIdsFromDB(registrationUnit); }
public Boolean checkIdsAndTenantIdsFromDB(RegistrationUnit registrationUnit) { RegistrationUnitSearchCriteria regnUnitSearchIdAndTenantId = new RegistrationUnitSearchCriteria(); regnUnitSearchIdAndTenantId.setId(registrationUnit.getId()); regnUnitSearchIdAndTenantId.setTenantId(registrationUnit.getTenantId()); String query = registrationUnitQueryBuilder.getSelectQuery(regnUnitSearchIdAndTenantId); try { @SuppressWarnings("unused") RegistrationUnit regnUnit = jdbcTemplate.queryForObject(query, rowMapper); } catch (DataAccessException e) { jdbcTemplate.execute("ROLLBACK"); return false; } return true; }
RegistrationUnitRepository { public Boolean checkIdsAndTenantIdsFromDB(RegistrationUnit registrationUnit) { RegistrationUnitSearchCriteria regnUnitSearchIdAndTenantId = new RegistrationUnitSearchCriteria(); regnUnitSearchIdAndTenantId.setId(registrationUnit.getId()); regnUnitSearchIdAndTenantId.setTenantId(registrationUnit.getTenantId()); String query = registrationUnitQueryBuilder.getSelectQuery(regnUnitSearchIdAndTenantId); try { @SuppressWarnings("unused") RegistrationUnit regnUnit = jdbcTemplate.queryForObject(query, rowMapper); } catch (DataAccessException e) { jdbcTemplate.execute("ROLLBACK"); return false; } return true; } }
RegistrationUnitRepository { public Boolean checkIdsAndTenantIdsFromDB(RegistrationUnit registrationUnit) { RegistrationUnitSearchCriteria regnUnitSearchIdAndTenantId = new RegistrationUnitSearchCriteria(); regnUnitSearchIdAndTenantId.setId(registrationUnit.getId()); regnUnitSearchIdAndTenantId.setTenantId(registrationUnit.getTenantId()); String query = registrationUnitQueryBuilder.getSelectQuery(regnUnitSearchIdAndTenantId); try { @SuppressWarnings("unused") RegistrationUnit regnUnit = jdbcTemplate.queryForObject(query, rowMapper); } catch (DataAccessException e) { jdbcTemplate.execute("ROLLBACK"); return false; } return true; }  }
RegistrationUnitRepository { public Boolean checkIdsAndTenantIdsFromDB(RegistrationUnit registrationUnit) { RegistrationUnitSearchCriteria regnUnitSearchIdAndTenantId = new RegistrationUnitSearchCriteria(); regnUnitSearchIdAndTenantId.setId(registrationUnit.getId()); regnUnitSearchIdAndTenantId.setTenantId(registrationUnit.getTenantId()); String query = registrationUnitQueryBuilder.getSelectQuery(regnUnitSearchIdAndTenantId); try { @SuppressWarnings("unused") RegistrationUnit regnUnit = jdbcTemplate.queryForObject(query, rowMapper); } catch (DataAccessException e) { jdbcTemplate.execute("ROLLBACK"); return false; } return true; }  void create(RegistrationUnit registrationUnit); List<RegistrationUnit> search(RegistrationUnitSearchCriteria regnUnitSearchCriteria); void update(RegistrationUnit registrationUnit); Long getIdNextVal(); Boolean checkIdsAndTenantIdsFromDB(RegistrationUnit registrationUnit); }
RegistrationUnitRepository { public Boolean checkIdsAndTenantIdsFromDB(RegistrationUnit registrationUnit) { RegistrationUnitSearchCriteria regnUnitSearchIdAndTenantId = new RegistrationUnitSearchCriteria(); regnUnitSearchIdAndTenantId.setId(registrationUnit.getId()); regnUnitSearchIdAndTenantId.setTenantId(registrationUnit.getTenantId()); String query = registrationUnitQueryBuilder.getSelectQuery(regnUnitSearchIdAndTenantId); try { @SuppressWarnings("unused") RegistrationUnit regnUnit = jdbcTemplate.queryForObject(query, rowMapper); } catch (DataAccessException e) { jdbcTemplate.execute("ROLLBACK"); return false; } return true; }  void create(RegistrationUnit registrationUnit); List<RegistrationUnit> search(RegistrationUnitSearchCriteria regnUnitSearchCriteria); void update(RegistrationUnit registrationUnit); Long getIdNextVal(); Boolean checkIdsAndTenantIdsFromDB(RegistrationUnit registrationUnit);  }