@BeforeClass中没有抛出异常

时间:2018-03-07 11:54:13

标签: android testing junit

我正在编写一些测试,并且碰到了一个我在互联网上没有发现的问题,所以我转向了stackoverflow。

代码:

@BeforeClass
public static void setUp() throws Exception{
    boolean isFalse = false;
    if(!isFalse)
        throw new IOException("I want to be throwing in the console");
}

以上代码是我所拥有的简化版本。我有几个测试,每当我运行测试类时,而不是@BeforeClass抛出异常,它表示"没有找到测试",但我可以在logcat中看到异常+ stacktrace。为什么@BeforeClass不会像往常一样在控制台中抛出异常?

我正在使用Java 8和JUnit 4.12

0 个答案:

没有答案