title: member variables in JUnit tests
body: <p>i came across something interesting while running some unit tests. i have the following method:</p>
  
  <pre><code>private void createSchemaIfNecessary() throws SQLException, IOException{
      if(!schemaExists){
           try (Connection connection = dataSource.getConnection(); Statement statement = connection.createStatement();) {
               statement.execute(getSQLByFileName(GOLF_COURSE_TABLE_CREATION_SCRIPT));
               statement.execute(getSQLByFileName(GOLF_COURSE_HOLE_TABLE_CREATION_SCRIPT));
               connection.commit();
               schemaExists = true;
           }
      }
  }
  </code></pre>
  
  <p>each unit test calls this method to determine whether or not to create the tables. the <code>schemaExists</code> variable is a member variable. i noticed that as each test was running, there were cases where even after hitting the <code>schemaExists = true;</code> line, the next time the method was called, <code>schemaExists</code> evaluated to false. i then made the variable static, and that fixed the problem.</p>
  
  <p>As the individual unit tests are running, don't they all run within the context of a single instance of the unit test class?</p>