title: JUnit parameterised testcase reading different files as input
body: <p>How to create a parametrised JUnit testcase that reads a list of files under a folder as input.The number of files inside the folder can be huge. So is there a way to solve it without taking too much heap space?</p>
  <p>Found these solution:</p>
  <pre><code>@Parameters
  public static Collection&lt;String&gt; data()  throws Exception{
      String file1 = new String(Files.readAllBytes(
          Paths.get(ConfigTest.class.getResource(&quot;config1.xml&quot;).toURI())
      ));
      String file2 = new String(Files.readAllBytes(
          Paths.get(ConfigTest.class.getResource(&quot;config2.xml&quot;).toURI())
      ));
  
      Collection&lt;String&gt; data = new ArrayList&lt;String&gt;();
      data.add(file1);
      data.add(file2);
      return data;
  }
  </code></pre>
  <p>But what will be space consumed while running the testcase when the number of files is more (~200)</p>