右击一个类,然后:GoTo==>test ,就可以新建这个类的测试用例了,简单粗暴,
如果想要不污染数据库,就在一个测试用例
的标签@Test 下面在加上@RollBack
这样:
@Test @Rollback public void getByAppealId() { NegativeEvaluationDO negativeEvaluationDO = negativeEvaluationService.getByAppealId(appealId1); assertNotEquals(negativeEvaluationDO,null); assertEquals(negativeEvaluationDO.getAppealId(),appealId1); assertEquals(negativeEvaluationDO.getNegativeEvaluationInfo().getDriverId(),driverId); NegativeEvaluationDO negativeEvaluationDO2 = negativeEvaluationService.getByAppealId(unappealId); assertEquals(negativeEvaluationDO2,null); }