Java Reference
In-Depth Information
if (event.type ## JavaParseEvent.FOUND_CLASS)
if (event.type ## JavaParseEvent.FOUND_MEMBER)
if (event.type ## JavaParseEvent.END_PARSING)
// return the resulting page
public Element getResult() {
return page;
To test the front end component we provide the source code of a class and
observe the documentation produced. The test class TestParse uses the class
described in Section 8.4.4. The result produced by the documenter is
checked using the same technique adopted in the previous prototype, i.e. by
checking the presence of a set of substrings in a given order.
The expected strings are a little tricky: when we want to match a tag we
have to take into account that some of them can contain parameters. Thus
if we expect a simple tag (e.g. “<BODY>” ) and the output contains that tag
with parameters (e.g. “<BODY bgcolor # “white”>” ) the match fails. To solve
this problem we include in the expected strings only the opening character
of the tag and its name omitting the closing character of the tag (e.g.
“<BODY” ).
public class TestParse extends TestCase {
public void testSimple(){
String source #
"// this is a test class...\n" !
"class TestClass {\n" !
" String an_attribute;\n" !
" public int a_public_attribute;\n" !
" public void a_method(int a_parameter){\n" !
" String s;\n" !
" s # \"string content\"; }\n" !
" private int another_method() { return 0; }\n" !
Parser parser # new JavaLanguage();
SimpleDocumenter doc # new SimpleDocumenter
Element page # doc.getResult();
assertTrue(page! # null );
Search WWH ::

Custom Search