mercredi 7 mars 2018

Exceptions not thrown from within @BeforeClass

I am writing some tests and have bumped into an issue that I did not find happening to anyone else on the internet, so I turned to stackoverflow.

Code:

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

The above code is the simplified version of what I have. I have a couple of tests and whenever I run the test class, instead of @BeforeClass throwing me the exception, it states that "No tests were found", but I can see the exception + stacktrace in the logcat. Why doesn't the @BeforeClass throw the exception as per usual, in the console?

I am using Java 8 and JUnit 4.12

Aucun commentaire:

Enregistrer un commentaire