title: Junit with @Parameters to test data from file
body: <p>I am trying to read data from a file and use the data for testing the procs. Even the proc to be tested is determined from the contents of the file.</p>
  
  <p>Sample.txt is the file from which I read the data, the file contains the following data</p>
  
  <pre><code>testproc=sample_check('N')
  output=yes
  type=function
  testproc=sample_check('N')
  output=yes
  type=function
  testproc=sample_check('N')
  output=yes
  type=function
  </code></pre>
  
  <p>The below program tries to read the file and populate its contents into a 2 dimensional String array.</p>
  
  <pre><code>@RunWith(value = Parameterized.class)
  public class Testdata extends Testdb {
  
      public String expected;
      public String actual;
  
      @Parameters
      public static Collection&lt;String[]&gt; getTestParameters() {
          String param[][] = new String [3][3];
          String temp[] = new String [3];
          int i = 0;
          int j = 0;
          try{
              BufferedReader br = new BufferedReader(new FileReader("sample.txt"));
              String strLine;
              String methodkey       = "testproc";
              String methodtypekey   = "type";
              String methodoutputkey = "output";
              String method = "";
              String methodtype = "";
              String methodoutput = "";
  
              //Read File Line By Line
              while ((strLine = br.readLine()) != null)
              {
                  StringTokenizer st = new StringTokenizer(strLine, "=");
                  while(st.hasMoreTokens())
                  {
                      String key = st.nextToken();
                      String val = st.nextToken();
                      if (key.trim().equalsIgnoreCase(methodkey))
                      {
                          method = val.trim();
                          temp[j] = "SELECT " + method + " FROM dual";
                          j++;
                      }
                      else if (key.trim().equalsIgnoreCase(methodoutputkey))
                      {
                          methodoutput = val.trim();
                          temp[j] = methodoutput;
                          j++;
                      }
                      else if (key.trim().equalsIgnoreCase(methodtypekey))
                      {
                          methodtype = val.trim();
                          if (methodtype.trim().equalsIgnoreCase("function"))
                          {
                              System.out.println(i + " " + method);
                              param[i] = temp;
                              i++;
                              j = 0;
                          }
                      }
                  }
  
              }
          }
          catch (Exception e){//Catch exception if any
              System.err.println("Error: " + e.getMessage());
          }
  
          return Arrays.asList(param)           ;
      }
  
      public Testdata(String[] par) {
          this.expected = par[0];
          this.actual = par[1];
      }
  
      @Test
      public void test_file_data() //throws java.io.IOException
      {
          testString("Output should be"+expected , expected, actual);
      }
  
  
  }
  </code></pre>
  
  <p>I receive an error 
  java.lang.IllegalArgumentException: wrong number of arguments</p>
  
  <p>testString is a method that connects to the database to check if the actual value tallies with the expected result. This takes two string values as argument.</p>
  
  <p>My question is how should 
  return Arrays.asList(param)
  and method 
  public Testdata(String[] par)
  look like?</p>
  
  <p>I tested using this and it works fine but since I read from a file, I want to use an array which needs to be returned using return Arrays.asList</p>
  
  <pre><code>return Arrays.asList(new String[][]{
              { "yes", "SELECT sample_check('N') FROM dual"},
              { "yes", "SELECT sample_check('N') FROM dual"},
              { "yes", "SELECT sample_check('N') FROM dual"}
      })           ;
  }
  
  public Testdata(String expected,
                             String actual) {
      this.expected = expected;
      this.actual = actual;
  }
  </code></pre>
  
  <p>Any advice on getting this working?</p>