package dk.itu.oop.lecture6; import java.util.List; import java.util.ArrayList; import java.util.Iterator; import java.lang.reflect.*; public class UnitTester { /** testClass is the class that contains the testcases */ private Class testClass; /** testMethods is an vector of the methods that contain * consists the tests to be executed */ private List testMethods; /** test object is an instance of testClass. */ private Object testObject; /** Set the class to be testet. The className must be a name in classpath. */ private void setClass(String className) throws ClassNotFoundException, InstantiationException, IllegalAccessException { testClass = Class.forName(className); testObject = testClass.newInstance(); } /**get the methods in testClass that takes no arguments, and with * a methodName that starts with "test". */ private void getMethods(){ testMethods = new ArrayList(); try{ Method[] all = testClass.getDeclaredMethods(); for (int i = 0; i