单元测试

@Test(Excepted=BuinessException.class);
Mockito.verify(this.testService.times(3)).insertDataBase(Mockito.any());
assertThat(dialogJob.getNewList()).isNotEmpty()
code smell
pojo
TDD 3 laws

判断单元测试成功与否:
  1、通过断言的返回值来判断
  2、无返回值时,Mockito.verify(messageService,times(2)).insertAlertRelation(Mockito.any());
写单元测试失败test:
  用@Test(Excepted=BuinessException.class);,抛了异常单元测试会通过
posted @ 2018-11-06 10:59  一只发霉的猪  阅读(128)  评论(0编辑  收藏  举报