Discuss / Java / junit5下assertThrows当不满足条件时才会抛出异常?

junit5下assertThrows当不满足条件时才会抛出异常?

Topic source
@Testvoid testNegative() {    assertThrows(IllegalArgumentException.class, () -> {        Factorial.fact(1);    });}

是测试时根本不会抛出任何异常,idea2021,junit5.7

使用来测试 抛出的 异常 是不是 

IllegalArgumentException.class,

  • 1

Reply