CommonBizUtils { public static String generatedIdCardNo(){ int provinceCode = PROVINCE_CODE_LIST.get(RandUtils.randomInt(PROVINCE_CODE_LIST.size())); return generatedIdCardNo(provinceCode, null); } private  CommonBizUtils(); static String generatedIdCardNo(); static String generatedIdCardNo(String province); static String generatedIdCardNo(String province, String birthYearStr); static String generatedIdCardNo(int provinceCode, String birthYearStr); static boolean checkIdCardNo(String cardNo);  }
@Test public void testGeneratedIdCardNo(){ for (int i = 0; i < 100; i++) { String cardNo = CommonBizUtils.generatedIdCardNo(); boolean rs = CommonBizUtils.checkIdCardNo(cardNo); if(!rs){ System.out.println("cardno["+cardNo+"] error"); } Assert.assertTrue(rs); } for (int i = 0; i < 100; i++) { String cardNo = CommonBizUtils.generatedIdCardNo("广东", "1984"); System.out.println("cardno["+cardNo+"]"); boolean rs = CommonBizUtils.checkIdCardNo(cardNo); if(!rs){ System.out.println("cardno["+cardNo+"] error"); } Assert.assertTrue(rs); } }