import java.util.regex.Pattern; public class TestUI { private static Pattern p = Pattern.compile(\"^[A-Za-z0-9()+-]+$\"); public static void main(String[]
You should take a look at parameterized unit tests (introduced in JUnit 4).
Daniel Mayer's blog has an example of this.
Another, more simple example is on mkyong's webpage