public List<goodsInfo>  selectBy(){
List<goodsInfo>  list=new ArrayList<goodsInfo>();
Connection con=this.con;
sql="select * from goodsinfo where goodsPrice>500";
try {
ps=con.prepareStatement(sql);

rs=ps.executeQuery();
while(rs.next()){
goodsInfo gi=new goodsInfo(rs.getString("goodsId"),rs.getString("goodsName"),rs.getInt("goodsPrice"),rs.getString("goodsType"));
list.add(gi);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return list;

}在写测试类的时候结果都是空指针错误,不附加where条件结果出来又是对的请问这是为什么 怎么解决