title: Can a JUnit testmethod have a argument?
body: <pre><code>import java.util.regex.Pattern;
  
  public class TestUI {
      private static Pattern p = Pattern.compile("^[A-Za-z0-9()+-]+$");
  
      public static void main(String[] args) {   
          // Test case1
          String[] str=test();
  
          System.out.println(str[0]+str.length);
          match("Alphanumeric(Text)");
      }
  
      private static String[] test() {
  
          boolean res;
          String[] array={"a","b","c","d","e"};
          for(int i=0;i&lt;array.length;i++){
              System.out.println(match(array[i]));
              res=match(array[i]);
              if(res=true)
                  calltomethod(array);
          }
  
          return array;   
      }
  
      private static boolean match(String s) {
          return p.matcher(s).matches();
      }
  
  }
  </code></pre>
  
  <p>In the above code I need to pass the array as a argument to a JUnit method, the above code will be present in a JUnit class, can I have these kind of methods in a JUnit class and a test =method with argument?</p>