Java Reference
In-Depth Information
ByteArrayOutputStream buffer
#
new
ByteArrayOutputStream();
page.serialize(
new
PrintStream(buffer));
System.out.println(buffer.toString());
String[] expected
#
{
"<HTML>",
"<head><title>Class: TestClass</title></head>",
"<BODY","<H1>",
"<FONT","color
#
\"navy\"","TestClass","</FONT>",
"</H1>",
"<FONT","color
#
\"navy\"","Public members:","</FONT>",
"<FONT","color
#
\"green\"",
"<UL>","<LI>","int a_public_attribute",
"<LI>","void a_method(int a_parameter)","</UL>",
"</FONT>",
"</BODY>",
"</HTML>"};
assertContainsInOrder(buffer.toString(),expected);
}
}
8.6
■
Prototype 3: Graphical driver
The core functionality of the application is provided by the HTML object
model component and the front-end component, which were developed in
the previous phases. To use the application, and possibly test it, a user inter-
face is needed. The user interface must draw the core components and route
input and outputs. We have chosen to provide a graphical user interface for
several reasons:
it is a common practice to have a user interface even for the simplest
application;
■
it is easier to use and to understand;
■
it allows the resulting HTML to be shown;
■
the user can easily play with the application by dropping Java code and
observe the documentation generated by the application.
■
8.6.1
Analysis
Since the specification gives no details about the user interface, we are
free to use whatever solution we prefer. We will opt for the simplest solution
that allows:
visualizing the documentation;
■
easily inserting and modifying Java classes to be documented; and
■
activating the documentation process.
■