Design a test harness system based on Java annotations. The user should be able to attach to

Question:

Design a “test harness” system based on Java annotations. The user should be able to attach to a method an annotation that specifies parameters to be passed to a test run of the method, and values expected to be returned. For simplicity, you may assume that parameters and return values will all be strings or instances of built-in types. Using the annotation processing facility of Java 6, you should automatically generate a new method, test() in any class that has methods with @Test annotations. This method should call the an notated methods with the specified parameters, test the return values, and report any discrepancies. It should also call the test methods of any nested classes. Be sure to include a mechanism to invoke the test method of every top-level class. For an extra challenge, devise a way to specify multiple tests of a single method, and a way to test exceptions thrown, in addition to values returned.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: