title: JUnit base test auto setUp
body: <p>I'd like to write a <code>BaseTest</code> class that simply provides a "universal <code>setUp()</code> method" for all extending subclasses:</p>
  
  <pre><code>public class BaseTest {
      @Before
      public void setUp() {
          System.out.println("setUp() was called!");
  
          // Doesn't really matter what this is doing...
          EnvironmentConfigurator.configureEnvForTesting();
      }
  }
  </code></pre>
  
  <p>Then:</p>
  
  <pre><code>public class WidgetTest extends BaseTest {
      @Test
      public void test1() {
          fail();
      }
  
      @Test
      public void test2() {
          fail();
      }
  }
  </code></pre>
  
  <p>So ideally, every time a subclass method annotated by <code>@Test</code> is executed, JUnit would first call the <code>BaseTest#setUp()</code> method, which does whatever (doesn't really matter). Perhaps its resetting some mock states to an initial value so that each test can start on a "clean slate", etc. Again, doesn't really matter.</p>
  
  <p>Unfortunately when I run this code, I only see <code>setUp() was called!</code> printing to the screen <strong>once</strong>, so clearly <code>BaseTest</code> isn't "wrapping" my <code>@Test</code> methods the way I want. Is there any way to achieve this? Thanks in advance!</p>