@Test public void test_should_map_result_set_to_entity() throws Exception { Mockito.when(rs.next()).thenReturn(true).thenReturn(false); when((Long) rs.getObject("scd_id")).thenReturn(1L); when(rs.getString("scd_code")).thenReturn("1"); when((Double) rs.getObject("scd_uomfrom")).thenReturn(0.0); when((Double) rs.getObject("scd_uomto")).thenReturn(1000.0); when((Double) rs.getObject("scd_amountorpercentage")).thenReturn(100.0); when((Long) rs.getObject("scd_servicecharge")).thenReturn(1L); when(rs.getString("scd_tenantid")).thenReturn("default"); final ServiceChargeDetails expectedserviceChargeDetails = getServiceChargeDetails(); final ServiceChargeDetails actualserviceChargeDetails = serviceChargeDetailsRowMapper.mapRow(rs, 1); assertTrue(expectedserviceChargeDetails.equals(actualserviceChargeDetails)); }
@Override public ServiceChargeDetails mapRow(final ResultSet rs, final int rowNum) throws SQLException { final ServiceChargeDetails serviceChargeDetail = new ServiceChargeDetails(); serviceChargeDetail.setId((Long) rs.getObject("scd_id")); serviceChargeDetail.setCode(rs.getString("scd_code")); serviceChargeDetail.setUomFrom((Double) rs.getObject("scd_uomfrom")); serviceChargeDetail.setUomTo((Double) rs.getObject("scd_uomto")); serviceChargeDetail.setAmountOrpercentage((Double) rs.getObject("scd_amountorpercentage")); serviceChargeDetail.setServiceCharge((Long) rs.getObject("scd_servicecharge")); serviceChargeDetail.setTenantId(rs.getString("scd_tenantid")); return serviceChargeDetail; }
ServiceChargeDetailsRowMapper implements RowMapper<ServiceChargeDetails> { @Override public ServiceChargeDetails mapRow(final ResultSet rs, final int rowNum) throws SQLException { final ServiceChargeDetails serviceChargeDetail = new ServiceChargeDetails(); serviceChargeDetail.setId((Long) rs.getObject("scd_id")); serviceChargeDetail.setCode(rs.getString("scd_code")); serviceChargeDetail.setUomFrom((Double) rs.getObject("scd_uomfrom")); serviceChargeDetail.setUomTo((Double) rs.getObject("scd_uomto")); serviceChargeDetail.setAmountOrpercentage((Double) rs.getObject("scd_amountorpercentage")); serviceChargeDetail.setServiceCharge((Long) rs.getObject("scd_servicecharge")); serviceChargeDetail.setTenantId(rs.getString("scd_tenantid")); return serviceChargeDetail; } }
ServiceChargeDetailsRowMapper implements RowMapper<ServiceChargeDetails> { @Override public ServiceChargeDetails mapRow(final ResultSet rs, final int rowNum) throws SQLException { final ServiceChargeDetails serviceChargeDetail = new ServiceChargeDetails(); serviceChargeDetail.setId((Long) rs.getObject("scd_id")); serviceChargeDetail.setCode(rs.getString("scd_code")); serviceChargeDetail.setUomFrom((Double) rs.getObject("scd_uomfrom")); serviceChargeDetail.setUomTo((Double) rs.getObject("scd_uomto")); serviceChargeDetail.setAmountOrpercentage((Double) rs.getObject("scd_amountorpercentage")); serviceChargeDetail.setServiceCharge((Long) rs.getObject("scd_servicecharge")); serviceChargeDetail.setTenantId(rs.getString("scd_tenantid")); return serviceChargeDetail; }  }
ServiceChargeDetailsRowMapper implements RowMapper<ServiceChargeDetails> { @Override public ServiceChargeDetails mapRow(final ResultSet rs, final int rowNum) throws SQLException { final ServiceChargeDetails serviceChargeDetail = new ServiceChargeDetails(); serviceChargeDetail.setId((Long) rs.getObject("scd_id")); serviceChargeDetail.setCode(rs.getString("scd_code")); serviceChargeDetail.setUomFrom((Double) rs.getObject("scd_uomfrom")); serviceChargeDetail.setUomTo((Double) rs.getObject("scd_uomto")); serviceChargeDetail.setAmountOrpercentage((Double) rs.getObject("scd_amountorpercentage")); serviceChargeDetail.setServiceCharge((Long) rs.getObject("scd_servicecharge")); serviceChargeDetail.setTenantId(rs.getString("scd_tenantid")); return serviceChargeDetail; }  @Override ServiceChargeDetails mapRow(final ResultSet rs, final int rowNum); }
ServiceChargeDetailsRowMapper implements RowMapper<ServiceChargeDetails> { @Override public ServiceChargeDetails mapRow(final ResultSet rs, final int rowNum) throws SQLException { final ServiceChargeDetails serviceChargeDetail = new ServiceChargeDetails(); serviceChargeDetail.setId((Long) rs.getObject("scd_id")); serviceChargeDetail.setCode(rs.getString("scd_code")); serviceChargeDetail.setUomFrom((Double) rs.getObject("scd_uomfrom")); serviceChargeDetail.setUomTo((Double) rs.getObject("scd_uomto")); serviceChargeDetail.setAmountOrpercentage((Double) rs.getObject("scd_amountorpercentage")); serviceChargeDetail.setServiceCharge((Long) rs.getObject("scd_servicecharge")); serviceChargeDetail.setTenantId(rs.getString("scd_tenantid")); return serviceChargeDetail; }  @Override ServiceChargeDetails mapRow(final ResultSet rs, final int rowNum);  }