KentBeck/junit — Issue #394: @BeforeClass of superclass is not executed
Author: gonzen
Created: 2012-03-06 08:58:02+00:00
State: open

Contrary to the statement in `@BeforeClass` annotation javadoc :
``` /** The @BeforeClass methods of superclasses will be run before those the current class. */ ```
The `@BeforeClass` annotated method of superclass is not called if there is another `@BeforeClass` is subclass.

```java
public abstract class SuperTest {
@BeforeClass
public static void beforeClass() throws Exception {
fail("why don't you call me ?"); // never fails
}
}

public class MyTestA extends SuperTest {
@BeforeClass
public static void beforeClass() {
fail("Thanks for calling"); // fails here
}

@Test
public void test() {
fail("Failure expected from MyTestA.beforeClass()");
}
}

public class MyTestB extends SuperTest {
@BeforeClass
public static void beforeClass() {
}

@Test
public void test() {
fail("Failure expected from SuperTest.beforeClass()"); // fails here
}
}

```