如何为Jdbc Rowmapper编写测试用例

时间:2019-10-24 12:08:46

标签: junit

我是单元测试的新手,我不了解如何为Jdbc RowMapper编写测试用例,能否有人指导我,我该怎么写...

映射器类

public class BaaisnRowMapper implements RowMapper<RowMapperServerResponse>{

    @Override
    public RowMapperServerResponse mapRow(ResultSet rs, int rowNum) throws SQLException {

        RowMapperServerResponse rowMapperServerResponse = new RowMapperServerResponse();
        rowMapperServerResponse.setMaster_kit_id(rs.getInt("master_ckt_id"));
        rowMapperServerResponse.setId_type(rs.getString("id_type"));
        rowMapperServerResponse.setProduct(rs.getString("product"));
        rowMapperServerResponse.setSeq_no(rs.getInt("seq_no"));
        rowMapperServerResponse.setName(rs.getString("name"));
        rowMapperServerResponse.setDependent_count(rs.getInt("dependent_count"));
        rowMapperServerResponse.setCreate_time(rs.getString("create_time"));
        return rowMapperServerResponse;
    }
}

模型类

public class RowMapperServerResponse {

    private int master_kit_id;
    private String id_type;
    private String product;
    private int seq_no;
    private String name;
    private int dependent_count;
    private String create_time;
}

0 个答案:

没有答案