title: Difference between using junit setup() method and calling a method from the tests itself
body: <p>I tried looking for this over StackOverflow and even Google, but either I am using wrong keywords to find my answer or there is no direct answer yet. </p>
  
  <p>My question is, is there a difference in performance or functionalities between using the setup() method and calling a method from within the test itself?</p>
  
  <p>For example:</p>
  
  <ol>
  <li><p>Tests with a setup method annotated with @Before annotation, which is called for each test run.</p>
  
  <pre><code>public class TestSetup extends TestCase {
      private String name;
  
      @Before
      public void setup(  ) {
          this.name = "abc";
      }
  
      @Test
      public void test1() { assertEquals("xyz", this.name); }
  
      @Test
      public void test2() { assertEquals("abc", this.name); }
  }
  </code></pre></li>
  <li><p>Writing a test which calls a method before executing. </p>
  
  <pre><code>public class TestSetup extends TestCase {
      private String name;
  
      public void setName() {
          this.name = "abc";
      }
  
      @Test
      public void test1() {
          setName();
          assertEquals("xyz", this.name);
      }
  
      @Test
      public void test2() {
          setName();
          assertEquals("abc", this.name);
      }
  }
  </code></pre></li>
  </ol>
  
  <p>What difference does this make except for the fact that in the latter case, the programmer needs to be aware that (s)he has to call the setup functions for the ones (s)he actually wants to use it.</p>