title: @Before/@BeforeEach inheritance behaviour change JUnit4 / JUnit5
body: <p>When migrating from JUnit4 to JUnit5 I found a change in the behaviour of JUnit4 and JUnit5 and wanted to check if the change was a bug in JUnit4 or in JUnit5 and how to do it correctly.</p>
  
  <p>Lets assume the following structure:</p>
  
  <p>One base class</p>
  
  <pre><code>public class BaseTestClass {
  
      @Before
      public void setUp(){
          System.out.println("Base Test Class");
      }
  }
  </code></pre>
  
  <p>Another class that inherits from this base class</p>
  
  <pre><code>public class InheritsFromBase extends BaseTestClass {
  
      @Override
      public void setUp() {
          System.out.println("I inherit from base");
  
          super.setUp();
      }
  }
  </code></pre>
  
  <p>And an actual test class</p>
  
  <pre><code>public class ActualTests extends InheritsFromBase {
  
      @Test
      public void myTest(){
          Assert.assertTrue(true);
      }
  }
  </code></pre>
  
  <p>If I run <code>myTest()</code> in JUnit 4 then the <code>setUp()</code> method of both, <code>BaseTestClass</code> and <code>InheritsFromBase</code> is called.</p>
  
  <p>After migrating this code to JUnit5, the <code>setUp()</code> methods are not called anymore. I had to manually add the <code>@BeforeEach</code> annotation on <code>InheritsFromBase</code>.</p>
  
  <p>Resulting in the following classes:</p>
  
  <pre><code>public class BaseTestClass {
  
      @BeforeEach
      public void setUp(){
          System.out.println("Base Test Class");
      }
  }
  
  public class InheritsFromBase extends BaseTestClass {
  
      @Override
      @BeforeEach
      public void setUp() {
          System.out.println("I inherit from base");
  
          super.setUp();
      }
  }
  
  public class ActualTests extends InheritsFromBase {
  
      @Test
      public void myTest(){
          Assertions.assertTrue(true);
      }
  }
  </code></pre>
  
  <p>So my question: Was the behaviour in JUnit4 correct or in JUnit5?</p>