@Test public void test_should_map_result_set_to_entity() throws Exception { Mockito.when(rs.next()).thenReturn(true).thenReturn(false); when(rs.getLong("sc_id")).thenReturn(1L); when(rs.getString("sc_code")).thenReturn("1"); when(rs.getString("sc_servicetype")).thenReturn("No Due Certificate"); when((Boolean) rs.getObject("sc_servicechargeapplicable")).thenReturn(true); when(rs.getString("sc_servicechargetype")).thenReturn("slab"); when(rs.getString("sc_description")).thenReturn("certificate will be issued"); when((Boolean) rs.getObject("sc_active")).thenReturn(true); when((Long) rs.getObject("sc_effectivefrom")).thenReturn(15678956L); when((Long) rs.getObject("sc_effectiveto")).thenReturn(15678968L); when((Boolean) rs.getObject("sc_outsideulb")).thenReturn(false); when(rs.getString("sc_tenantid")).thenReturn("default"); when((Long) rs.getObject("sc_createdby")).thenReturn(1L); when((Long) rs.getObject("sc_createddate")).thenReturn(15678956L); when((Long) rs.getObject("sc_lastmodifiedby")).thenReturn(1L); when((Long) rs.getObject("sc_lastmodifieddate")).thenReturn(15678956L); final ServiceCharge expectedServiceCharge = getServiceCharge(); final ServiceCharge actualServiceCharge = serviceChargeRowMapper.mapRow(rs, 1); assertTrue(expectedServiceCharge.equals(actualServiceCharge)); }
@Override public ServiceCharge mapRow(final ResultSet rs, final int rowNum) throws SQLException { final ServiceCharge serviceCharge = new ServiceCharge(); serviceCharge.setId(rs.getLong("sc_id")); serviceCharge.setCode(rs.getString("sc_code")); serviceCharge.setServiceType(rs.getString("sc_servicetype")); serviceCharge.setServiceChargeApplicable((Boolean) rs.getObject("sc_servicechargeapplicable")); serviceCharge.setServiceChargeType(rs.getString("sc_servicechargetype")); serviceCharge.setDescription(rs.getString("sc_description")); serviceCharge.setActive((Boolean) rs.getObject("sc_active")); serviceCharge.setEffectiveFrom((Long) rs.getObject("sc_effectivefrom")); serviceCharge.setEffectiveTo((Long) rs.getObject("sc_effectiveto")); serviceCharge.setOutsideUlb((Boolean) rs.getObject("sc_outsideulb")); serviceCharge.setTenantId(rs.getString("sc_tenantid")); serviceCharge.setCreatedBy((Long) rs.getObject("sc_createdby")); serviceCharge.setCreatedDate((Long) rs.getObject("sc_createddate")); serviceCharge.setLastModifiedBy((Long) rs.getObject("sc_lastmodifiedby")); serviceCharge.setLastModifiedDate((Long) rs.getObject("sc_lastmodifieddate")); return serviceCharge; }
ServiceChargeRowMapper implements RowMapper<ServiceCharge> { @Override public ServiceCharge mapRow(final ResultSet rs, final int rowNum) throws SQLException { final ServiceCharge serviceCharge = new ServiceCharge(); serviceCharge.setId(rs.getLong("sc_id")); serviceCharge.setCode(rs.getString("sc_code")); serviceCharge.setServiceType(rs.getString("sc_servicetype")); serviceCharge.setServiceChargeApplicable((Boolean) rs.getObject("sc_servicechargeapplicable")); serviceCharge.setServiceChargeType(rs.getString("sc_servicechargetype")); serviceCharge.setDescription(rs.getString("sc_description")); serviceCharge.setActive((Boolean) rs.getObject("sc_active")); serviceCharge.setEffectiveFrom((Long) rs.getObject("sc_effectivefrom")); serviceCharge.setEffectiveTo((Long) rs.getObject("sc_effectiveto")); serviceCharge.setOutsideUlb((Boolean) rs.getObject("sc_outsideulb")); serviceCharge.setTenantId(rs.getString("sc_tenantid")); serviceCharge.setCreatedBy((Long) rs.getObject("sc_createdby")); serviceCharge.setCreatedDate((Long) rs.getObject("sc_createddate")); serviceCharge.setLastModifiedBy((Long) rs.getObject("sc_lastmodifiedby")); serviceCharge.setLastModifiedDate((Long) rs.getObject("sc_lastmodifieddate")); return serviceCharge; } }
ServiceChargeRowMapper implements RowMapper<ServiceCharge> { @Override public ServiceCharge mapRow(final ResultSet rs, final int rowNum) throws SQLException { final ServiceCharge serviceCharge = new ServiceCharge(); serviceCharge.setId(rs.getLong("sc_id")); serviceCharge.setCode(rs.getString("sc_code")); serviceCharge.setServiceType(rs.getString("sc_servicetype")); serviceCharge.setServiceChargeApplicable((Boolean) rs.getObject("sc_servicechargeapplicable")); serviceCharge.setServiceChargeType(rs.getString("sc_servicechargetype")); serviceCharge.setDescription(rs.getString("sc_description")); serviceCharge.setActive((Boolean) rs.getObject("sc_active")); serviceCharge.setEffectiveFrom((Long) rs.getObject("sc_effectivefrom")); serviceCharge.setEffectiveTo((Long) rs.getObject("sc_effectiveto")); serviceCharge.setOutsideUlb((Boolean) rs.getObject("sc_outsideulb")); serviceCharge.setTenantId(rs.getString("sc_tenantid")); serviceCharge.setCreatedBy((Long) rs.getObject("sc_createdby")); serviceCharge.setCreatedDate((Long) rs.getObject("sc_createddate")); serviceCharge.setLastModifiedBy((Long) rs.getObject("sc_lastmodifiedby")); serviceCharge.setLastModifiedDate((Long) rs.getObject("sc_lastmodifieddate")); return serviceCharge; }  }
ServiceChargeRowMapper implements RowMapper<ServiceCharge> { @Override public ServiceCharge mapRow(final ResultSet rs, final int rowNum) throws SQLException { final ServiceCharge serviceCharge = new ServiceCharge(); serviceCharge.setId(rs.getLong("sc_id")); serviceCharge.setCode(rs.getString("sc_code")); serviceCharge.setServiceType(rs.getString("sc_servicetype")); serviceCharge.setServiceChargeApplicable((Boolean) rs.getObject("sc_servicechargeapplicable")); serviceCharge.setServiceChargeType(rs.getString("sc_servicechargetype")); serviceCharge.setDescription(rs.getString("sc_description")); serviceCharge.setActive((Boolean) rs.getObject("sc_active")); serviceCharge.setEffectiveFrom((Long) rs.getObject("sc_effectivefrom")); serviceCharge.setEffectiveTo((Long) rs.getObject("sc_effectiveto")); serviceCharge.setOutsideUlb((Boolean) rs.getObject("sc_outsideulb")); serviceCharge.setTenantId(rs.getString("sc_tenantid")); serviceCharge.setCreatedBy((Long) rs.getObject("sc_createdby")); serviceCharge.setCreatedDate((Long) rs.getObject("sc_createddate")); serviceCharge.setLastModifiedBy((Long) rs.getObject("sc_lastmodifiedby")); serviceCharge.setLastModifiedDate((Long) rs.getObject("sc_lastmodifieddate")); return serviceCharge; }  @Override ServiceCharge mapRow(final ResultSet rs, final int rowNum); }
ServiceChargeRowMapper implements RowMapper<ServiceCharge> { @Override public ServiceCharge mapRow(final ResultSet rs, final int rowNum) throws SQLException { final ServiceCharge serviceCharge = new ServiceCharge(); serviceCharge.setId(rs.getLong("sc_id")); serviceCharge.setCode(rs.getString("sc_code")); serviceCharge.setServiceType(rs.getString("sc_servicetype")); serviceCharge.setServiceChargeApplicable((Boolean) rs.getObject("sc_servicechargeapplicable")); serviceCharge.setServiceChargeType(rs.getString("sc_servicechargetype")); serviceCharge.setDescription(rs.getString("sc_description")); serviceCharge.setActive((Boolean) rs.getObject("sc_active")); serviceCharge.setEffectiveFrom((Long) rs.getObject("sc_effectivefrom")); serviceCharge.setEffectiveTo((Long) rs.getObject("sc_effectiveto")); serviceCharge.setOutsideUlb((Boolean) rs.getObject("sc_outsideulb")); serviceCharge.setTenantId(rs.getString("sc_tenantid")); serviceCharge.setCreatedBy((Long) rs.getObject("sc_createdby")); serviceCharge.setCreatedDate((Long) rs.getObject("sc_createddate")); serviceCharge.setLastModifiedBy((Long) rs.getObject("sc_lastmodifiedby")); serviceCharge.setLastModifiedDate((Long) rs.getObject("sc_lastmodifieddate")); return serviceCharge; }  @Override ServiceCharge mapRow(final ResultSet rs, final int rowNum);  }