KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > maven > usability > plugin > Xpp3ParseTest


1 package org.apache.maven.usability.plugin;
2
3 import junit.framework.TestCase;
4
5 import org.apache.maven.usability.plugin.io.xpp3.ParamdocXpp3Reader;
6 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
7
8 import java.io.IOException JavaDoc;
9 import java.io.InputStream JavaDoc;
10 import java.io.InputStreamReader JavaDoc;
11 import java.util.Map JavaDoc;
12 import java.util.Properties JavaDoc;
13
14 public class Xpp3ParseTest
15     extends TestCase
16 {
17     
18     public void testParse() throws IOException JavaDoc, XmlPullParserException
19     {
20         InputStream JavaDoc testDocStream = getClass().getClassLoader().getResourceAsStream( "test.paramdoc.xml" );
21         ParamdocXpp3Reader reader = new ParamdocXpp3Reader();
22         
23         ExpressionDocumentation documentation = reader.read(new InputStreamReader JavaDoc( testDocStream ) );
24         
25         Map JavaDoc exprs = documentation.getExpressionsBySyntax();
26         
27         Expression expr = (Expression) exprs.get( "localRepository" );
28         
29         assertNotNull( expr );
30         
31         Properties JavaDoc p = expr.getCliOptions();
32         
33         assertNotNull( p );
34         
35         assertEquals( 1, p.size() );
36         
37         assertEquals( "Override the local repository location on a per-build basis.", p.getProperty( "-Dmaven.repo.local=/path/to/local/repo" ) );
38         
39     }
40
41 }
42
Popular Tags