title: "folder has not yet been created" error when using JUnit temporary folder in testclass
body: <p>I get the error "the temporary folder has not yet been created", which comes from an <code>IllegalStateException</code> thrown by the <code>TemporaryFolder.getRoot()</code> method. It looks like it's not initialized, but my research showed me that this is usually the case when the temp folder is initialized in setUp()-method. But using it with <code>@Rule</code> like I did should work in my opinion. Any ideas?</p>
  
  <p>The test class </p>
  
  <pre><code>public class FileReaderTest extends TestCase {
  
    @Rule
    public TemporaryFolder folder = new TemporaryFolder();
  
    public FileReaderTest(String testName) {
      super(testName);
    }
  
    @Override
    protected void setUp() throws Exception {
      super.setUp();
    }
  
    @Override
    protected void tearDown() throws Exception {
      super.tearDown();
    }
  
    public void testCSVWriterAndReader() throws Exception{
      testWriterAndReader(new CSVFileWriter(), new CSVFileReader());
    }
  
    private void testWriterAndReader(FileWriteService writer, FileReader reader) throws Exception {
      folder = new TemporaryFolder();
      File tempFile = folder.newFile("test.csv");
      DataSet initializedData = createMockData();
      writer.writeDataSetToFile(initializedData, tempFile.getPath());
      DataSet readData = reader.getDataFromFile(new FileInputStream(tempFile));
      assertEquals(initializedData, readData);
    }
  }
  </code></pre>