KentBeck/junit — Issue #396: If @Before throws an exception, then @After of the other subclasses should not be executed
Author: viggyprabhu
Created: 2012-03-08 16:58:16+00:00
State: open

Hi,

I have 3 classes such that A extends from B which extends from C. Each one of them have a @Before and @After block. If @Before block in C actually throws an exception, then @After blocks from A and B should not be executed and only @After block from C should be executed.
In my particular case, I was creating a folder in @Before and in @After writing a file in the folder in class B. Now since @Before at C threw an exception, @Before of B did not get executed but it executed @After of B which caused another exception as the folder it expected did not exists.
What do you suggest?

Regards,

Vignesh