The program will serve as an Empirical Test Application
(ETA). Under current conditions in order to test functionality of
Java files, a separate test file has to be constructed to invoke
functions with given parameters to insure that the functions work as
desired. Should new tests be desired, the test file will have to be
modified to invoke these new tests on the class. For each class that
a company develops, a separate test file will have to be created.
The purpose of this ETA is to eliminate this unnecessary coding.
Using reflection this ETA can determine the existing functions in a
class and execute them. This ETA will be capable of doing this with
any class it can find in the class path. Also with this method test
procedures will not need to be hard coded, rather the methods will be
exposed such that they can be executed with the desired parameters at
runtime.
Reflection of Java exposes the complete innards of all classes.
Given an object of type class, the methods of a given type can be
extracted at runtime. The class also exposes constructors so that the
object type can be constructed without really knowing what the object
truly is. The class type also exposes the super classes of the given
type. This can be used to determine if the given type is a GUI
component and thus hand it over to a panel to be displayed. Private
and protected restrictions are easily set aside so that testing of
normally unexposed functionality can take place. Using the
description of the methods exposed by the class type, the parameters
of the method can be constructed and passed in when the method is
called.
Higher-level Bean technology defines types within the exported
interface. Set and get method are paired together along with change
and vetoable change listeners to provide enhanced functionality to
simple data members. Using objects such as the Introspector or
BeanInfo these advanced interfaces can be determined and implemented
as well. The runtime class with allows the execution of javac on
dynamically created listeners and veto able listeners. Allowing
these functionalities to be tested as well. Other additional
advanced interfaces exist in JavaBean that also can be implemented
abstractly.