notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
r891 - in trunk/main/util/cli/src/test/net/dpml/cli: . commandline option resource util validation validation/protect
- From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
- To: notify-dpml AT lists.ibiblio.org
- Subject: r891 - in trunk/main/util/cli/src/test/net/dpml/cli: . commandline option resource util validation validation/protect
- Date: Mon, 9 Jan 2006 05:12:37 +0100
Author: mcconnell
Date: 2006-01-09 05:12:29 +0100 (Mon, 09 Jan 2006)
New Revision: 891
Modified:
trunk/main/util/cli/src/test/net/dpml/cli/CommandLineDefaultsTest.java
trunk/main/util/cli/src/test/net/dpml/cli/DocumentationTest.java
trunk/main/util/cli/src/test/net/dpml/cli/PrecedenceTest.java
trunk/main/util/cli/src/test/net/dpml/cli/commandline/ParserTest.java
trunk/main/util/cli/src/test/net/dpml/cli/commandline/PropertiesCommandLineTest.java
trunk/main/util/cli/src/test/net/dpml/cli/option/ArgumentTest.java
trunk/main/util/cli/src/test/net/dpml/cli/option/CommandTest.java
trunk/main/util/cli/src/test/net/dpml/cli/option/DefaultOptionTest.java
trunk/main/util/cli/src/test/net/dpml/cli/option/GroupTest.java
trunk/main/util/cli/src/test/net/dpml/cli/option/NestedGroupTest.java
trunk/main/util/cli/src/test/net/dpml/cli/option/ParentTest.java
trunk/main/util/cli/src/test/net/dpml/cli/option/PropertyOptionTest.java
trunk/main/util/cli/src/test/net/dpml/cli/option/SwitchTest.java
trunk/main/util/cli/src/test/net/dpml/cli/resource/ResourceHelperTest.java
trunk/main/util/cli/src/test/net/dpml/cli/util/ComparatorsTest.java
trunk/main/util/cli/src/test/net/dpml/cli/util/HelpFormatterTest.java
trunk/main/util/cli/src/test/net/dpml/cli/validation/ClassValidatorTest.java
trunk/main/util/cli/src/test/net/dpml/cli/validation/DateValidatorTest.java
trunk/main/util/cli/src/test/net/dpml/cli/validation/EnumValidatorTest.java
trunk/main/util/cli/src/test/net/dpml/cli/validation/FileValidatorTest.java
trunk/main/util/cli/src/test/net/dpml/cli/validation/NumberValidatorTest.java
trunk/main/util/cli/src/test/net/dpml/cli/validation/TimeZoneTestSuite.java
trunk/main/util/cli/src/test/net/dpml/cli/validation/URLValidatorTest.java
trunk/main/util/cli/src/test/net/dpml/cli/validation/protect/ProtectedClass.java
Log:
checkstyle ...
Modified:
trunk/main/util/cli/src/test/net/dpml/cli/CommandLineDefaultsTest.java
===================================================================
--- trunk/main/util/cli/src/test/net/dpml/cli/CommandLineDefaultsTest.java
2006-01-09 02:55:41 UTC (rev 890)
+++ trunk/main/util/cli/src/test/net/dpml/cli/CommandLineDefaultsTest.java
2006-01-09 04:12:29 UTC (rev 891)
@@ -28,11 +28,11 @@
/**
* Tests the interaction of command line values and defaults supplied in
different ways.
*
- * Tests marked _Parsed involve values parsed from a command line.
+ * Tests marked xxxParsed involve values parsed from a command line.
*
- * Tests marked _Method involve defaults supplied in the query method.
+ * Tests marked xxxMethod involve defaults supplied in the query method.
*
- * Tests marked _Option involce defaults specified in the model.
+ * Tests marked xxxOption involve defaults specified in the model.
*
* @author Rob Oxspring
*/
@@ -169,7 +169,7 @@
/**
* DOCUMENT ME!
*/
- public void testSwitch_Method( )
+ public void testSwitchMethod( )
{
final Option o = optionSwitchNull( );
final WriteableCommandLine cl = parsedSwitchNull( o );
@@ -180,7 +180,7 @@
/**
* DOCUMENT ME!
*/
- public void testSwitch_Method_Option( )
+ public void testSwitchMethodOption( )
{
final Option o = optionSwitchOff( );
final WriteableCommandLine cl = parsedSwitchNull( o );
@@ -191,7 +191,7 @@
/**
* DOCUMENT ME!
*/
- public void testSwitch_Option( )
+ public void testSwitchOption( )
{
final Option o = optionSwitchOn( );
final WriteableCommandLine cl = parsedSwitchNull( o );
@@ -202,7 +202,7 @@
/**
* DOCUMENT ME!
*/
- public void testSwitch_Parsed( )
+ public void testSwitchParsed( )
{
final Option o = optionSwitchNull( );
final WriteableCommandLine cl = parsedSwitchOn( o );
@@ -213,7 +213,7 @@
/**
* DOCUMENT ME!
*/
- public void testSwitch_Parsed_Method( )
+ public void testSwitchParsedMethod( )
{
final Option o = optionSwitchOff( );
final WriteableCommandLine cl = parsedSwitchOn( o );
@@ -224,7 +224,7 @@
/**
* DOCUMENT ME!
*/
- public void testSwitch_Parsed_Method_Option( )
+ public void testSwitchParsedMethodOption( )
{
final Option o = optionSwitchOff( );
final WriteableCommandLine cl = parsedSwitchOn( o );
@@ -235,7 +235,7 @@
/**
* DOCUMENT ME!
*/
- public void testSwitch_Parsed_Option( )
+ public void testSwitchParsedOption( )
{
final Option o = optionSwitchOff( );
final WriteableCommandLine cl = parsedSwitchOn( o );
@@ -257,7 +257,7 @@
/**
* DOCUMENT ME!
*/
- public void testValues_Method( )
+ public void testValuesMethod( )
{
final Option o = optionValueMissing( );
final WriteableCommandLine cl = parsedValueMissing( o );
@@ -268,7 +268,7 @@
/**
* DOCUMENT ME!
*/
- public void testValues_Method_Option( )
+ public void testValuesMethodOption( )
{
final Option o = optionValuePresent( );
final WriteableCommandLine cl = parsedValueMissing( o );
@@ -279,7 +279,7 @@
/**
* DOCUMENT ME!
*/
- public void testValues_Option( )
+ public void testValuesOption( )
{
final Option o = optionValuePresent( );
final WriteableCommandLine cl = parsedValueMissing( o );
@@ -290,7 +290,7 @@
/**
* DOCUMENT ME!
*/
- public void testValues_Parsed( )
+ public void testValuesParsed( )
{
final Option o = optionValueMissing( );
final WriteableCommandLine cl = parsedValuePresent( o );
@@ -301,7 +301,7 @@
/**
* DOCUMENT ME!
*/
- public void testValues_Parsed_Method( )
+ public void testValuesParsedMethod( )
{
final Option o = optionValueMissing( );
final WriteableCommandLine cl = parsedValuePresent( o );
@@ -312,7 +312,7 @@
/**
* DOCUMENT ME!
*/
- public void testValues_Parsed_Method_Option( )
+ public void testValuesParsedMethodOption( )
{
final Option o = optionValuePresent( );
final WriteableCommandLine cl = parsedValuePresent( o );
@@ -323,7 +323,7 @@
/**
* DOCUMENT ME!
*/
- public void testValues_Parsed_Option( )
+ public void testValuesParsedOption( )
{
final Option o = optionValuePresent( );
final WriteableCommandLine cl = parsedValuePresent( o );
Modified: trunk/main/util/cli/src/test/net/dpml/cli/DocumentationTest.java
===================================================================
--- trunk/main/util/cli/src/test/net/dpml/cli/DocumentationTest.java
2006-01-09 02:55:41 UTC (rev 890)
+++ trunk/main/util/cli/src/test/net/dpml/cli/DocumentationTest.java
2006-01-09 04:12:29 UTC (rev 891)
@@ -63,12 +63,10 @@
Option version = obuilder.withLongName( "version" )
.withDescription( "Displays version
information and then exits" )
.create( );
-
Option help = obuilder.withShortName( "h" ).withShortName( "?" )
.withLongName( "help" )
.withDescription( "Displays help on usage and
then exits" )
.create( );
-
ArgumentBuilder abuilder = new ArgumentBuilder( );
Argument logFile = abuilder.withDescription( "The log file to write
to" )
.withName( "file" ).withMinimum( 1 )
@@ -76,7 +74,6 @@
Option log = obuilder.withArgument( logFile ).withShortName( "log" )
.withDescription( "Log progress information to
a file" )
.create( );
-
GroupBuilder gbuilder = new GroupBuilder( );
Group outputQuality = gbuilder.withName( "quality" )
.withDescription( "Controls the
quality of console output" )
@@ -96,38 +93,28 @@
.withOption( obuilder.withShortName(
"d" )
.withDescription(
"Debug" )
.create( )
).create( );
-
Group options = new GroupBuilder( ).withName( "options" )
.withOption( version )
.withOption( help ).withOption(
log )
.withOption( outputQuality
).create( );
-
final String[] args = new String[]{"--bad-option"};
-
Parser parser = new Parser( );
parser.setHelpFormatter( helpFormatter );
parser.setGroup( options );
parser.setHelpOption( help );
-
CommandLine commandLine = parser.parseAndHelp( args );
-
if( commandLine != null )
{
if( commandLine.hasOption( version ) )
{
System.out.println( "MyApp ver 1.0" );
-
return;
}
-
if( commandLine.hasOption( "-log" ) )
{
String filename = (String) commandLine.getValue( "-log" );
-
- //...
}
}
-
try
{
commandLine = parser.parse( args );
@@ -175,7 +162,6 @@
p.setHelpTrigger( "--help" );
CommandLine cl = p.parseAndHelp( new String[]{} );
-
if( cl == null )
{
System.exit( -1 );
@@ -320,32 +306,25 @@
parser.setGroup( options );
CommandLine cl = parser.parse( args );
-
if( cl.hasOption( help ) )
{
//displayHelp();
return;
}
-
if( cl.hasOption( "-version" ) )
{
//displayVersion();
return;
}
-
if( cl.hasOption( logfile ) )
{
String file = (String) cl.getValue( logfile );
-
//setLogFile();
}
-
List targetList = cl.getValues( targets );
-
for( Iterator i = targetList.iterator( ); i.hasNext( ); )
{
String target = (String) i.next( );
-
//doTarget(target);
}
@@ -355,14 +334,11 @@
hf.getFullUsageSettings( ).add( DisplaySetting.DISPLAY_GROUP_NAME );
hf.getFullUsageSettings( ).add(
DisplaySetting.DISPLAY_GROUP_ARGUMENT );
hf.getFullUsageSettings( ).remove(
DisplaySetting.DISPLAY_GROUP_EXPANDED );
-
hf.getLineUsageSettings( ).add(
DisplaySetting.DISPLAY_PROPERTY_OPTION );
hf.getLineUsageSettings( ).add(
DisplaySetting.DISPLAY_PARENT_ARGUMENT );
hf.getLineUsageSettings( )
.add( DisplaySetting.DISPLAY_ARGUMENT_BRACKETED );
-
hf.getDisplaySettings( ).remove(
DisplaySetting.DISPLAY_GROUP_ARGUMENT );
-
hf.setGroup( options );
// redirect printed stuff to a string
hf.setPrintWriter( new PrintWriter( new StringWriter( ) ) );
Modified: trunk/main/util/cli/src/test/net/dpml/cli/PrecedenceTest.java
===================================================================
--- trunk/main/util/cli/src/test/net/dpml/cli/PrecedenceTest.java
2006-01-09 02:55:41 UTC (rev 890)
+++ trunk/main/util/cli/src/test/net/dpml/cli/PrecedenceTest.java
2006-01-09 04:12:29 UTC (rev 891)
@@ -34,7 +34,7 @@
*/
public class PrecedenceTest extends TestCase
{
- private final String[] args = new String[]{"-file"};
+ private final String[] m_args = new String[]{"-file"};
/**
* DOCUMENT ME!
@@ -48,7 +48,7 @@
final Group options = new GroupBuilder( ).withOption(
oBuilder.withShortName(
"file" ).create( ) ).create( );
- final CommandLine cl = buildCommandLine( options, args );
+ final CommandLine cl = buildCommandLine( options, m_args );
assertEquals( new String[]{"-file"}, cl );
}
@@ -66,7 +66,7 @@
"f" ).withArgument( aBuilder.create( ) ).create( ) )
.create( );
- final CommandLine cl = buildCommandLine( options, args );
+ final CommandLine cl = buildCommandLine( options, m_args );
assertEquals( new String[]{"-f"}, cl );
}
@@ -88,7 +88,7 @@
.withOption( oBuilder.withShortName(
"e" )
.create( )
).create( );
- final CommandLine cl = buildCommandLine( options, args );
+ final CommandLine cl = buildCommandLine( options, m_args );
assertEquals( new String[]{"-f", "-i", "-l", "-e"}, cl );
}
@@ -113,7 +113,7 @@
.withChildren(
children )
.create( )
).create( );
- final CommandLine cl = buildCommandLine( options, args );
+ final CommandLine cl = buildCommandLine( options, m_args );
assertEquals( new String[]{"-f", "-i", "-l", "-e"}, cl );
}
@@ -122,7 +122,7 @@
*
* @throws OptionException DOCUMENT ME!
*/
- public void XtestSimpleVsArgument( ) throws OptionException
+ public void xtestSimpleVsArgument( ) throws OptionException
{
final DefaultOptionBuilder oBuilder = new DefaultOptionBuilder( );
final GroupBuilder gBuilder = new GroupBuilder( );
@@ -134,7 +134,7 @@
.withArgument(
aBuilder.create( ) )
.create( )
).create( );
- final CommandLine cl = buildCommandLine( options, args );
+ final CommandLine cl = buildCommandLine( options, m_args );
assertEquals( new String[]{"-f"}, cl );
}
@@ -143,7 +143,7 @@
*
* @throws OptionException DOCUMENT ME!
*/
- public void XtestSimpleVsBurst( ) throws OptionException
+ public void xtestSimpleVsBurst( ) throws OptionException
{
final DefaultOptionBuilder oBuilder = new DefaultOptionBuilder( );
final GroupBuilder gBuilder = new GroupBuilder( );
@@ -158,7 +158,7 @@
.withOption( oBuilder.withShortName(
"e" )
.create( )
).create( );
- final CommandLine cl = buildCommandLine( options, args );
+ final CommandLine cl = buildCommandLine( options, m_args );
assertEquals( new String[]{"-f", "-i", "-l", "-e"}, cl );
}
@@ -167,7 +167,7 @@
*
* @throws OptionException DOCUMENT ME!
*/
- public void XtestSimpleVsChildren( ) throws OptionException
+ public void xtestSimpleVsChildren( ) throws OptionException
{
final DefaultOptionBuilder oBuilder = new DefaultOptionBuilder( );
final GroupBuilder gBuilder = new GroupBuilder( );
@@ -189,7 +189,7 @@
.withChildren(
children )
.create( )
).create( );
- final CommandLine cl = buildCommandLine( options, args );
+ final CommandLine cl = buildCommandLine( options, m_args );
assertEquals( new String[]
{
"-f", "-i", "--ci", "-l", "--cl", "-e", "--ce"
@@ -217,7 +217,7 @@
.withOption( oBuilder.withShortName(
"e" )
.create( )
).create( );
- final CommandLine cl = buildCommandLine( options, args );
+ final CommandLine cl = buildCommandLine( options, m_args );
assertEquals( new String[]{"-f"}, cl );
}
@@ -244,7 +244,7 @@
.withArgument(
aBuilder.create( ) )
.create( )
).create( );
- final CommandLine cl = buildCommandLine( options, args );
+ final CommandLine cl = buildCommandLine( options, m_args );
assertEquals( new String[]{"-f"}, cl );
}
@@ -282,7 +282,7 @@
.withLongName(
"be" )
.create( )
).create( );
- final CommandLine cl = buildCommandLine( options, args );
+ final CommandLine cl = buildCommandLine( options, m_args );
assertEquals( new String[]
{
"-f", "-i", "--ci", "-l", "--cl", "-e", "--ce"
@@ -294,7 +294,7 @@
*
* @throws OptionException DOCUMENT ME!
*/
- public void XtestSimpleVsArgumentVsBurst( ) throws OptionException
+ public void xtestSimpleVsArgumentVsBurst( ) throws OptionException
{
final DefaultOptionBuilder oBuilder = new DefaultOptionBuilder( );
final GroupBuilder gBuilder = new GroupBuilder( );
@@ -312,7 +312,7 @@
.withOption( oBuilder.withShortName(
"e" )
.create( )
).create( );
- final CommandLine cl = buildCommandLine( options, args );
+ final CommandLine cl = buildCommandLine( options, m_args );
assertEquals( new String[]{"-f"}, cl );
}
@@ -321,7 +321,7 @@
*
* @throws OptionException DOCUMENT ME!
*/
- public void XtestSimpleVsArgumentVsChildren( ) throws OptionException
+ public void xtestSimpleVsArgumentVsChildren( ) throws OptionException
{
final DefaultOptionBuilder oBuilder = new DefaultOptionBuilder( );
final GroupBuilder gBuilder = new GroupBuilder( );
@@ -345,7 +345,7 @@
.withArgument(
aBuilder.create( ) )
.create( )
).create( );
- final CommandLine cl = buildCommandLine( options, args );
+ final CommandLine cl = buildCommandLine( options, m_args );
assertEquals( new String[]{"-f"}, cl );
}
@@ -354,7 +354,7 @@
*
* @throws OptionException DOCUMENT ME!
*/
- public void XtestSimpleVsBurstVsChildren( ) throws OptionException
+ public void xtestSimpleVsBurstVsChildren( ) throws OptionException
{
final DefaultOptionBuilder oBuilder = new DefaultOptionBuilder( );
final GroupBuilder gBuilder = new GroupBuilder( );
@@ -382,7 +382,7 @@
.withOption( oBuilder.withShortName(
"e" )
.create( )
).create( );
- final CommandLine cl = buildCommandLine( options, args );
+ final CommandLine cl = buildCommandLine( options, m_args );
assertEquals( new String[]{"-f", "-i", "-l", "-e"}, cl );
}
@@ -419,7 +419,7 @@
.withOption( oBuilder.withShortName(
"e" )
.create( )
).create( );
- final CommandLine cl = buildCommandLine( options, args );
+ final CommandLine cl = buildCommandLine( options, m_args );
assertEquals( new String[]{"-f"}, cl );
}
@@ -428,7 +428,7 @@
*
* @throws OptionException DOCUMENT ME!
*/
- public void XtestSimpleVsArgumentVsBurstVsChildren( )
+ public void xtestSimpleVsArgumentVsBurstVsChildren( )
throws OptionException
{
final DefaultOptionBuilder oBuilder = new DefaultOptionBuilder( );
@@ -459,7 +459,7 @@
.withOption( oBuilder.withShortName(
"e" )
.create( )
).create( );
- final CommandLine cl = buildCommandLine( options, args );
+ final CommandLine cl = buildCommandLine( options, m_args );
assertEquals( new String[]{"-f"}, cl );
}
Modified:
trunk/main/util/cli/src/test/net/dpml/cli/commandline/ParserTest.java
===================================================================
--- trunk/main/util/cli/src/test/net/dpml/cli/commandline/ParserTest.java
2006-01-09 02:55:41 UTC (rev 890)
+++ trunk/main/util/cli/src/test/net/dpml/cli/commandline/ParserTest.java
2006-01-09 04:12:29 UTC (rev 891)
@@ -24,36 +24,36 @@
*/
public class ParserTest extends TestCase
{
- private Parser parser;
- private DefaultOption verboseOption;
- private DefaultOption helpOption;
- private Group options;
- private HelpFormatter helpFormatter;
- private StringWriter out;
- private BufferedReader in;
+ private Parser m_parser;
+ private DefaultOption m_verboseOption;
+ private DefaultOption m_helpOption;
+ private Group m_options;
+ private HelpFormatter m_helpFormatter;
+ private StringWriter m_out;
+ private BufferedReader m_in;
/**
- * DOCUMENT ME!
+ * Test case setup.
*/
public void setUp( )
{
- parser = new Parser( );
+ m_parser = new Parser( );
final GroupBuilder gBuilder = new GroupBuilder( );
final DefaultOptionBuilder oBuilder = new DefaultOptionBuilder( );
- helpOption = oBuilder.withLongName( "help" ).withShortName( "h" )
+ m_helpOption = oBuilder.withLongName( "help" ).withShortName( "h" )
.create( );
- verboseOption = oBuilder.withLongName( "verbose" ).withShortName(
"v" )
+ m_verboseOption = oBuilder.withLongName( "verbose" ).withShortName(
"v" )
.create( );
- options = gBuilder.withOption( helpOption ).withOption(
verboseOption )
+ m_options = gBuilder.withOption( m_helpOption ).withOption(
m_verboseOption )
.create( );
- parser.setGroup( options );
+ m_parser.setGroup( m_options );
- helpFormatter = new HelpFormatter( );
- out = new StringWriter( );
- helpFormatter.setPrintWriter( new PrintWriter( out ) );
- parser.setHelpFormatter( helpFormatter );
+ m_helpFormatter = new HelpFormatter( );
+ m_out = new StringWriter( );
+ m_helpFormatter.setPrintWriter( new PrintWriter( m_out ) );
+ m_parser.setHelpFormatter( m_helpFormatter );
}
/**
@@ -61,12 +61,12 @@
*
* @throws OptionException DOCUMENT ME!
*/
- public void testParse_Successful( ) throws OptionException
+ public void testParseSuccessful( ) throws OptionException
{
- final CommandLine cl = parser.parse( new String[]{"-hv"} );
+ final CommandLine cl = m_parser.parse( new String[]{"-hv"} );
- assertTrue( cl.hasOption( helpOption ) );
- assertTrue( cl.hasOption( verboseOption ) );
+ assertTrue( cl.hasOption( m_helpOption ) );
+ assertTrue( cl.hasOption( m_verboseOption ) );
assertEquals( "--help --verbose", cl.toString( ) );
@@ -77,16 +77,16 @@
/**
* DOCUMENT ME!
*/
- public void testParse_WithUnexpectedOption( )
+ public void testParseWithUnexpectedOption( )
{
try
{
- parser.parse( new String[]{"--unexpected"} );
+ m_parser.parse( new String[]{"--unexpected"} );
fail( "OptionException" );
}
catch( OptionException e )
{
- assertEquals( options, e.getOption( ) );
+ assertEquals( m_options, e.getOption( ) );
//assertEquals("Unexpected --unexpected while processing
--help|--verbose",e.getMessage());
assertEquals( "Unexpected --unexpected while processing --help
--verbose",
e.getMessage( ) );
@@ -98,12 +98,12 @@
*
* @throws IOException DOCUMENT ME!
*/
- public void testParseAndHelp_Successful( ) throws IOException
+ public void testParseAndHelpSuccessful( ) throws IOException
{
- final CommandLine cl = parser.parseAndHelp( new String[]{"-v"} );
+ final CommandLine cl = m_parser.parseAndHelp( new String[]{"-v"} );
- assertTrue( cl.hasOption( verboseOption ) );
- assertEquals( "", out.getBuffer( ).toString( ) );
+ assertTrue( cl.hasOption( m_verboseOption ) );
+ assertEquals( "", m_out.getBuffer( ).toString( ) );
}
/**
@@ -111,11 +111,11 @@
*
* @throws IOException DOCUMENT ME!
*/
- public void testParseAndHelp_ByHelpOption( ) throws IOException
+ public void testParseAndHelpByHelpOption( ) throws IOException
{
- parser.setHelpOption( helpOption );
+ m_parser.setHelpOption( m_helpOption );
- assertNull( parser.parseAndHelp( new String[]{"-hv"} ) );
+ assertNull( m_parser.parseAndHelp( new String[]{"-hv"} ) );
inReader( );
assertInReaderUsage( );
@@ -127,11 +127,11 @@
*
* @throws IOException DOCUMENT ME!
*/
- public void testParseAndHelp_ByHelpTrigger( ) throws IOException
+ public void testParseAndHelpByHelpTrigger( ) throws IOException
{
- parser.setHelpTrigger( "--help" );
+ m_parser.setHelpTrigger( "--help" );
- assertNull( parser.parseAndHelp( new String[]{"-hv"} ) );
+ assertNull( m_parser.parseAndHelp( new String[]{"-hv"} ) );
inReader( );
assertInReaderUsage( );
@@ -143,10 +143,10 @@
*
* @throws IOException DOCUMENT ME!
*/
- public void testParseAndHelp_WithUnexpectedOption( )
+ public void testParseAndHelpWithUnexpectedOption( )
throws IOException
{
- assertNull( parser.parseAndHelp( new String[]{"--unexpected"} ) );
+ assertNull( m_parser.parseAndHelp( new String[]{"--unexpected"} ) );
inReader( );
//assertInReaderLine("Unexpected --unexpected while processing
--help|--verbose");
@@ -169,16 +169,16 @@
private void assertInReaderLine( final String string )
throws IOException
{
- assertEquals( string, in.readLine( ).trim( ) );
+ assertEquals( string, m_in.readLine( ).trim( ) );
}
private void assertInReaderEOF( ) throws IOException
{
- assertNull( in.readLine( ) );
+ assertNull( m_in.readLine( ) );
}
private void inReader( )
{
- in = new BufferedReader( new StringReader( out.getBuffer(
).toString( ) ) );
+ m_in = new BufferedReader( new StringReader( m_out.getBuffer(
).toString( ) ) );
}
}
Modified:
trunk/main/util/cli/src/test/net/dpml/cli/commandline/PropertiesCommandLineTest.java
===================================================================
---
trunk/main/util/cli/src/test/net/dpml/cli/commandline/PropertiesCommandLineTest.java
2006-01-09 02:55:41 UTC (rev 890)
+++
trunk/main/util/cli/src/test/net/dpml/cli/commandline/PropertiesCommandLineTest.java
2006-01-09 04:12:29 UTC (rev 891)
@@ -27,7 +27,7 @@
*/
public class PropertiesCommandLineTest extends AbstractCommandLineTestCase
{
- private Properties props = null;
+ private Properties m_properties = null;
/**
* DOCUMENT ME!
@@ -36,15 +36,15 @@
*/
protected CommandLine createCommandLine( )
{
- props = new Properties( );
- props.setProperty( "--present", "present value" );
- props.setProperty( "--alsopresent", "" );
- props.setProperty( "--multiple", "value 1|value 2|value 3" );
- props.setProperty( "--bool", "true" );
+ m_properties = new Properties( );
+ m_properties.setProperty( "--present", "present value" );
+ m_properties.setProperty( "--alsopresent", "" );
+ m_properties.setProperty( "--multiple", "value 1|value 2|value 3" );
+ m_properties.setProperty( "--bool", "true" );
- props.setProperty( "present", "present property" );
+ m_properties.setProperty( "present", "present property" );
- return new PropertiesCommandLine( m_root, props, '|' );
+ return new PropertiesCommandLine( m_root, m_properties, '|' );
}
/**
@@ -54,15 +54,15 @@
*/
protected CommandLine createCommandLineNoSep( )
{
- props = new Properties( );
- props.setProperty( "--present", "present value" );
- props.setProperty( "--alsopresent", "" );
- props.setProperty( "--multiple", "value 1|value 2|value 3" );
- props.setProperty( "--bool", "false" );
+ m_properties = new Properties( );
+ m_properties.setProperty( "--present", "present value" );
+ m_properties.setProperty( "--alsopresent", "" );
+ m_properties.setProperty( "--multiple", "value 1|value 2|value 3" );
+ m_properties.setProperty( "--bool", "false" );
- props.setProperty( "present", "present property" );
+ m_properties.setProperty( "present", "present property" );
- return new PropertiesCommandLine( m_root, props );
+ return new PropertiesCommandLine( m_root, m_properties );
}
/**
Modified: trunk/main/util/cli/src/test/net/dpml/cli/option/ArgumentTest.java
===================================================================
--- trunk/main/util/cli/src/test/net/dpml/cli/option/ArgumentTest.java
2006-01-09 02:55:41 UTC (rev 890)
+++ trunk/main/util/cli/src/test/net/dpml/cli/option/ArgumentTest.java
2006-01-09 04:12:29 UTC (rev 891)
@@ -27,10 +27,7 @@
import net.dpml.cli.resource.ResourceConstants;
import net.dpml.cli.resource.ResourceHelper;
-import java.text.ParseException;
-
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
@@ -46,7 +43,7 @@
*/
public class ArgumentTest extends AbstractArgumentTestCase
{
- private ResourceHelper resources = ResourceHelper.getResourceHelper( );
+ private static final ResourceHelper RESOURCES =
ResourceHelper.getResourceHelper( );
/**
* DOCUMENT ME!
@@ -132,7 +129,7 @@
// new ArgumentImpl("limit", "the last acceptable date", 10, 5,
'=', '\0',
// new
DateValidator(DateValidatorTest.YYYY_MM_YY), null, null, 0);
//} catch (IllegalArgumentException e) {
- //
assertEquals(resources.getMessage("Argument.minimum.exceeds.maximum"),
e.getMessage());
+ //
assertEquals(RESOURCES.getMessage("Argument.minimum.exceeds.maximum"),
e.getMessage());
//}
}
@@ -165,7 +162,7 @@
*
* @throws OptionException DOCUMENT ME!
*/
- public void testProcessValues_BoundaryQuotes( ) throws OptionException
+ public void testProcessValuesBoundaryQuotes( ) throws OptionException
{
final Argument option = buildUsernameArgument( );
final List args = list( "\"rob\"" );
@@ -184,7 +181,7 @@
*
* @throws OptionException DOCUMENT ME!
*/
- public void testProcessValues_SpareValues( ) throws OptionException
+ public void testProcessValuesSpareValues( ) throws OptionException
{
final Argument option = buildUsernameArgument( );
final List args = list( "rob", "secret" );
@@ -201,7 +198,7 @@
/**
* DOCUMENT ME!
*/
- public void testProcessValues_Optional( )
+ public void testProcessValuesOptional( )
{
final Argument option = buildTargetsArgument( );
final List args = list( );
@@ -230,7 +227,7 @@
*
* @throws OptionException DOCUMENT ME!
*/
- public void testProcessValues_Multiple( ) throws OptionException
+ public void testProcessValuesMultiple( ) throws OptionException
{
final Argument option = buildTargetsArgument( );
final List args = list( "compile", "test", "docs" );
@@ -250,7 +247,7 @@
*
* @throws OptionException DOCUMENT ME!
*/
- public void testProcessValues_Contracted( ) throws OptionException
+ public void testProcessValuesContracted( ) throws OptionException
{
final Argument option = buildTargetsArgument( );
final List args = list( "compile,test,javadoc", "checkstyle,jdepend"
);
@@ -268,7 +265,7 @@
/**
* DOCUMENT ME!
*/
- public void testProcessValues_ContractedTooFew( )
+ public void testProcessValuesContractedTooFew( )
{
final Argument option = buildHostArgument( );
final List args = list( "box1" );
@@ -290,7 +287,7 @@
/**
* DOCUMENT ME!
*/
- public void testProcessValues_ContractedTooMany( )
+ public void testProcessValuesContractedTooMany( )
{
final Argument option = buildHostArgument( );
final List args = list( "box1,box2,box3,box4" );
@@ -400,7 +397,7 @@
/**
* DOCUMENT ME!
*/
- public void testValidate_Minimum( )
+ public void testValidateMinimum( )
{
final Argument option = buildUsernameArgument( );
final WriteableCommandLine commandLine = commandLine( option, list(
) );
@@ -437,7 +434,7 @@
/**
* DOCUMENT ME!
*/
- public void testValidate_Maximum( )
+ public void testValidateMaximum( )
{
final Argument option = buildUsernameArgument( );
final WriteableCommandLine commandLine = commandLine( option, list(
) );
@@ -485,7 +482,7 @@
/**
* DOCUMENT ME!
*/
- public void testAppendUsage_Infinite( )
+ public void testAppendUsageInfinite( )
{
final Option option = buildTargetsArgument( );
final StringBuffer buffer = new StringBuffer( );
@@ -497,7 +494,7 @@
/**
* DOCUMENT ME!
*/
- public void testAppendUsage_InfiniteNoOptional( )
+ public void testAppendUsageInfiniteNoOptional( )
{
final Option option = buildTargetsArgument( );
final StringBuffer buffer = new StringBuffer( );
@@ -511,7 +508,7 @@
/**
* DOCUMENT ME!
*/
- public void testAppendUsage_InfiniteNoNumbering( )
+ public void testAppendUsageInfiniteNoNumbering( )
{
final Option option = buildTargetsArgument( );
final StringBuffer buffer = new StringBuffer( );
@@ -525,7 +522,7 @@
/**
* DOCUMENT ME!
*/
- public void testAppendUsage_Minimum( )
+ public void testAppendUsageMinimum( )
{
final Option option = buildHostArgument( );
final StringBuffer buffer = new StringBuffer( );
@@ -586,7 +583,7 @@
/**
* DOCUMENT ME!
*/
- public void testCanProcess_ConsumeRemaining( )
+ public void testCanProcessConsumeRemaining( )
{
final Option option = buildUsernameArgument( );
@@ -599,7 +596,7 @@
*
* @throws OptionException DOCUMENT ME!
*/
- public void testProcess_ConsumeRemaining( ) throws OptionException
+ public void testProcessConsumeRemaining( ) throws OptionException
{
final Option option = buildPathArgument( );
final List args = list( "options", "--", "--ignored", "-Dprop=val" );
@@ -619,7 +616,7 @@
/**
* DOCUMENT ME!
*/
- public void testProcess_ConsumeNothing( )
+ public void testProcessConsumeNothing( )
{
final Option option = buildPathArgument( );
final List args = list( "--" );
@@ -648,7 +645,7 @@
*
* @throws OptionException DOCUMENT ME!
*/
- public void testProcess_InterrogatedDefaultValue( )
+ public void testProcessInterrogatedDefaultValue( )
throws OptionException
{
final Option size = buildSizeArgument( );
@@ -713,7 +710,7 @@
*
* @throws OptionException DOCUMENT ME!
*/
- public void testProcess_InterrogatedDefaultValues( )
+ public void testProcessInterrogatedDefaultValues( )
throws OptionException
{
final Option bounds = buildBoundsArgument( );
@@ -739,7 +736,7 @@
*
* @throws OptionException DOCUMENT ME!
*/
- public void testProcess_StripBoundaryQuotes( ) throws OptionException
+ public void testProcessStripBoundaryQuotes( ) throws OptionException
{
final Option bounds = buildBoundsArgument( );
final List args = list( );
@@ -763,14 +760,14 @@
final GroupBuilder gbuilder = new GroupBuilder( );
final Argument inputfiles = abuilder.withName( "input"
).withMinimum( 0 )
.withMaximum( 0 ).create( );
- final Argument bad_outputfile = abuilder.withName( "output" )
+ final Argument badOutputFile = abuilder.withName( "output" )
.withMinimum( 1
).withMaximum( 2 )
.create( );
try
{
final Argument targets = new SourceDestArgument( inputfiles,
- bad_outputfile );
+ badOutputFile );
}
catch( final IllegalArgumentException exp )
{
Modified: trunk/main/util/cli/src/test/net/dpml/cli/option/CommandTest.java
===================================================================
--- trunk/main/util/cli/src/test/net/dpml/cli/option/CommandTest.java
2006-01-09 02:55:41 UTC (rev 890)
+++ trunk/main/util/cli/src/test/net/dpml/cli/option/CommandTest.java
2006-01-09 04:12:29 UTC (rev 891)
@@ -101,7 +101,7 @@
*
* @throws OptionException DOCUMENT ME!
*/
- public void testProcessParent_Spare( ) throws OptionException
+ public void testProcessParentSpare( ) throws OptionException
{
final Command option = buildLoginCommand( );
final List args = list( "login", "rob" );
@@ -134,7 +134,7 @@
/**
* DOCUMENT ME!
*/
- public void testCanProcess_BadMatch( )
+ public void testCanProcessBadMatch( )
{
final Command option = buildStartCommand( );
assertFalse( option.canProcess(
@@ -144,7 +144,7 @@
/**
* DOCUMENT ME!
*/
- public void testCanProcess_Alias( )
+ public void testCanProcessAlias( )
{
final Command option = buildStartCommand( );
assertTrue( option.canProcess(
@@ -286,7 +286,7 @@
/**
* DOCUMENT ME!
*/
- public void testAppendUsage_NoOptional( )
+ public void testAppendUsageNoOptional( )
{
final Option option = buildStartCommand( );
final StringBuffer buffer = new StringBuffer( );
@@ -300,7 +300,7 @@
/**
* DOCUMENT ME!
*/
- public void testAppendUsage_NoAlias( )
+ public void testAppendUsageNoAlias( )
{
final Option option = buildStartCommand( );
final StringBuffer buffer = new StringBuffer( );
Modified:
trunk/main/util/cli/src/test/net/dpml/cli/option/DefaultOptionTest.java
===================================================================
--- trunk/main/util/cli/src/test/net/dpml/cli/option/DefaultOptionTest.java
2006-01-09 02:55:41 UTC (rev 890)
+++ trunk/main/util/cli/src/test/net/dpml/cli/option/DefaultOptionTest.java
2006-01-09 04:12:29 UTC (rev 891)
@@ -89,7 +89,7 @@
*
* @throws OptionException DOCUMENT ME!
*/
- public void testProcessParent_Burst( ) throws OptionException
+ public void testProcessParentBurst( ) throws OptionException
{
final DefaultOption option = buildHelpOption( );
final List args = list( "-help" );
@@ -123,7 +123,7 @@
/**
* DOCUMENT ME!
*/
- public void testCanProcess_BadMatch( )
+ public void testCanProcessBadMatch( )
{
final DefaultOption option = buildHelpOption( );
assertFalse( option.canProcess(
@@ -216,7 +216,7 @@
/**
* DOCUMENT ME!
*/
- public void testAppendUsage_NoOptional( )
+ public void testAppendUsageNoOptional( )
{
final Option option = buildHelpOption( );
final StringBuffer buffer = new StringBuffer( );
@@ -230,7 +230,7 @@
/**
* DOCUMENT ME!
*/
- public void testAppendUsage_NoAlias( )
+ public void testAppendUsageNoAlias( )
{
final Option option = buildHelpOption( );
final StringBuffer buffer = new StringBuffer( );
@@ -269,11 +269,6 @@
assertEquals( "Displays the help", option.getDescription( ) );
}
- /*
- * (non-Javadoc)
- *
- * @see net.dpml.cli.OptionTestCase#testHelpLines()
- */
/**
* DOCUMENT ME!
*/
Modified: trunk/main/util/cli/src/test/net/dpml/cli/option/GroupTest.java
===================================================================
--- trunk/main/util/cli/src/test/net/dpml/cli/option/GroupTest.java
2006-01-09 02:55:41 UTC (rev 890)
+++ trunk/main/util/cli/src/test/net/dpml/cli/option/GroupTest.java
2006-01-09 04:12:29 UTC (rev 891)
@@ -176,7 +176,7 @@
/**
* DOCUMENT ME!
*/
- public void testCanProcess_BadMatch( )
+ public void testCanProcessBadMatch( )
{
final Group option = buildApacheCommandGroup( );
assertFalse( option.canProcess(
@@ -186,7 +186,7 @@
/**
* DOCUMENT ME!
*/
- public void testCanProcess_NullMatch( )
+ public void testCanProcessNullMatch( )
{
final Group option = buildApacheCommandGroup( );
assertFalse( option.canProcess(
@@ -236,7 +236,7 @@
*
* @throws OptionException DOCUMENT ME!
*/
- public void testProcess_Nested( ) throws OptionException
+ public void testProcessNested( ) throws OptionException
{
final Group option = buildApachectlGroup( );
final List args = list( "-h", "-k", "graceful" );
@@ -291,7 +291,7 @@
/**
* DOCUMENT ME!
*/
- public void testValidate_UnexpectedOption( )
+ public void testValidateUnexpectedOption( )
{
final Group option = buildApacheCommandGroup( );
final WriteableCommandLine commandLine = commandLine( option, list(
) );
@@ -313,7 +313,7 @@
/**
* DOCUMENT ME!
*/
- public void testValidate_MissingOption( )
+ public void testValidateMissingOption( )
{
final Group option = buildApacheCommandGroup( );
final WriteableCommandLine commandLine = commandLine( option, list(
) );
@@ -334,7 +334,7 @@
*
* @throws OptionException DOCUMENT ME!
*/
- public void testValidate_RequiredChild( ) throws OptionException
+ public void testValidateRequiredChild( ) throws OptionException
{
final Option required = new DefaultOptionBuilder( ).withLongName(
"required" ).withRequired( true ).create( );
@@ -400,7 +400,7 @@
/**
* DOCUMENT ME!
*/
- public void testAppendUsage_NoOptional( )
+ public void testAppendUsageNoOptional( )
{
final Option option = buildApacheCommandGroup( );
final StringBuffer buffer = new StringBuffer( );
@@ -415,7 +415,7 @@
/**
* DOCUMENT ME!
*/
- public void testAppendUsage_NoExpand( )
+ public void testAppendUsageNoExpand( )
{
final Option option = buildApacheCommandGroup( );
final StringBuffer buffer = new StringBuffer( );
@@ -429,7 +429,7 @@
/**
* DOCUMENT ME!
*/
- public void testAppendUsage_NoExpandOrName( )
+ public void testAppendUsageNoExpandOrName( )
{
final Option option = buildApacheCommandGroup( );
final StringBuffer buffer = new StringBuffer( );
@@ -444,7 +444,7 @@
/**
* DOCUMENT ME!
*/
- public void testAppendUsage_NoName( )
+ public void testAppendUsageNoName( )
{
final Option option = buildApacheCommandGroup( );
final StringBuffer buffer = new StringBuffer( );
@@ -458,7 +458,7 @@
/**
* DOCUMENT ME!
*/
- public void testAppendUsage_WithArgs( )
+ public void testAppendUsageWithArgs( )
{
final Option option = buildAntGroup( );
final StringBuffer buffer = new StringBuffer( );
@@ -544,7 +544,7 @@
/**
* DOCUMENT ME!
*/
- public void testHelpLines_NoExpanded( )
+ public void testHelpLinesNoExpanded( )
{
final Option option = buildApacheCommandGroup( );
final Set settings = new HashSet( DisplaySetting.ALL );
@@ -568,7 +568,7 @@
/**
* DOCUMENT ME!
*/
- public void testHelpLines_NoName( )
+ public void testHelpLinesNoName( )
{
final Option option = buildApacheCommandGroup( );
final Set settings = new HashSet( DisplaySetting.ALL );
Modified:
trunk/main/util/cli/src/test/net/dpml/cli/option/NestedGroupTest.java
===================================================================
--- trunk/main/util/cli/src/test/net/dpml/cli/option/NestedGroupTest.java
2006-01-09 02:55:41 UTC (rev 890)
+++ trunk/main/util/cli/src/test/net/dpml/cli/option/NestedGroupTest.java
2006-01-09 04:12:29 UTC (rev 891)
@@ -39,33 +39,39 @@
*/
public class NestedGroupTest extends AbstractCLITestCase
{
- final static DefaultOptionBuilder obuilder = new DefaultOptionBuilder(
);
- final static ArgumentBuilder abuilder = new ArgumentBuilder( );
- final static GroupBuilder gbuilder = new GroupBuilder( );
+ static final DefaultOptionBuilder OPTION_BUILDER = new
DefaultOptionBuilder( );
+ static final ArgumentBuilder ARG_BUILDER = new ArgumentBuilder( );
+ static final GroupBuilder GROUP_BUILDER = new GroupBuilder( );
static Group buildActionGroup( )
{
- return gbuilder.withName( "Action" ).withDescription( "Action" )
- .withMinimum( 1 ).withMaximum( 1 )
- .withOption( obuilder.withId( 5 ).withShortName( "e" )
- .withLongName( "encrypt" )
- .withDescription( "Encrypt
input" )
- .create( ) )
- .withOption( obuilder.withId( 6 ).withShortName( "d" )
- .withLongName( "decrypt" )
- .withDescription( "Decrypt
input" )
- .create( ) ).create( );
+ return GROUP_BUILDER.withName( "Action" )
+ .withDescription( "Action" )
+ .withMinimum( 1 ).withMaximum( 1 )
+ .withOption(
+ OPTION_BUILDER.withId( 5 )
+ .withShortName( "e" )
+ .withLongName( "encrypt" )
+ .withDescription( "Encrypt input" )
+ .create( ) )
+ .withOption(
+ OPTION_BUILDER.withId( 6 )
+ .withShortName( "d" )
+ .withLongName( "decrypt" )
+ .withDescription( "Decrypt input" )
+ .create( ) )
+ .create( );
}
static Group buildAlgorithmGroup( )
{
- return gbuilder.withName( "Algorithm" )
+ return GROUP_BUILDER.withName( "Algorithm" )
.withDescription( "Encryption Algorithm"
).withMaximum( 1 )
- .withOption( obuilder.withId( 0 ).withShortName( "b" )
+ .withOption( OPTION_BUILDER.withId( 0
).withShortName( "b" )
.withLongName( "blowfish" )
.withDescription( "Blowfish" )
.create( ) )
- .withOption( obuilder.withId( 1 ).withShortName( "3" )
+ .withOption( OPTION_BUILDER.withId( 1
).withShortName( "3" )
.withLongName( "3DES" )
.withDescription( "Triple DES" )
.create( ) ).create( );
@@ -73,39 +79,39 @@
static Group buildInputGroup( )
{
- return gbuilder.withName( "Input" ).withDescription( "Input" )
+ return GROUP_BUILDER.withName( "Input" ).withDescription( "Input" )
.withMinimum( 1 ).withMaximum( 1 )
- .withOption( obuilder.withId( 2 ).withShortName( "f" )
+ .withOption( OPTION_BUILDER.withId( 2
).withShortName( "f" )
.withLongName( "file" )
.withDescription( "Input file" )
- .withArgument(
abuilder.withName(
+ .withArgument(
ARG_BUILDER.withName(
"file" ).withMinimum( 1 ).withMaximum( 1 ).create( ) )
.create( ) )
- .withOption( obuilder.withId( 3 ).withShortName( "s" )
+ .withOption( OPTION_BUILDER.withId( 3
).withShortName( "s" )
.withLongName( "string" )
.withDescription( "Input string"
)
- .withArgument(
abuilder.withName(
+ .withArgument(
ARG_BUILDER.withName(
"string" ).withMinimum( 1 ).withMaximum( 1 ).create( ) )
.create( ) ).create( );
}
static Group buildEncryptionServiceGroup( Group[] nestedGroups )
{
- gbuilder.withName( "encryptionService" )
- .withOption( obuilder.withId( 4 ).withShortName( "h" )
+ GROUP_BUILDER.withName( "encryptionService" )
+ .withOption( OPTION_BUILDER.withId( 4 ).withShortName( "h" )
.withLongName( "help" )
.withDescription( "Print this message" )
.create( ) )
- .withOption( obuilder.withShortName( "k" ).withLongName(
"key" )
+ .withOption( OPTION_BUILDER.withShortName( "k"
).withLongName( "key" )
.withDescription( "Encryption key" )
.create( ) );
for( int i = 0; i < nestedGroups.length; i++ )
{
- gbuilder.withOption( nestedGroups[i] );
+ GROUP_BUILDER.withOption( nestedGroups[i] );
}
- return gbuilder.create( );
+ return GROUP_BUILDER.create( );
}
/**
@@ -194,11 +200,16 @@
for( int x = 0; x < expected.length; i++ )
{
System.out.println( " " + expected[i] );
- System.out.println( ( expected[i].equals(
actual.get( i ) )
- ? "== " : "!= " ) + actual.get( i ) );
+ if( expected[i].equals( actual.get( i ) ) )
+ {
+ System.out.println( "== " + actual.get( i ) );
+ }
+ else
+ {
+ System.out.println( "!= " + actual.get( i ) );
+ }
}
}
-
assertEquals( expected[i], actual.get( i ) );
}
}
Modified: trunk/main/util/cli/src/test/net/dpml/cli/option/ParentTest.java
===================================================================
--- trunk/main/util/cli/src/test/net/dpml/cli/option/ParentTest.java
2006-01-09 02:55:41 UTC (rev 890)
+++ trunk/main/util/cli/src/test/net/dpml/cli/option/ParentTest.java
2006-01-09 04:12:29 UTC (rev 891)
@@ -154,7 +154,7 @@
/**
* DOCUMENT ME!
*/
- public void testCanProcess_BadMatch( )
+ public void testCanProcessBadMatch( )
{
final Parent option = buildKParent( );
assertFalse( option.canProcess(
@@ -164,7 +164,7 @@
/**
* DOCUMENT ME!
*/
- public void testCanProcess_ContractedArgument( )
+ public void testCanProcessContractedArgument( )
{
final Parent option = buildLibParent( );
assertTrue( option.canProcess(
@@ -211,7 +211,7 @@
*
* @throws OptionException DOCUMENT ME!
*/
- public void testProcess_NoMatch( ) throws OptionException
+ public void testProcessNoMatch( ) throws OptionException
{
final Parent option = CommandTest.buildStartCommand( );
final List args = list( "whatever" );
@@ -237,7 +237,7 @@
*
* @throws OptionException DOCUMENT ME!
*/
- public void testProcess_Children( ) throws OptionException
+ public void testProcessChildren( ) throws OptionException
{
final Parent option = buildKParent( );
final List args = list( "-k", "start" );
@@ -261,7 +261,7 @@
*
* @throws OptionException DOCUMENT ME!
*/
- public void testProcess_Argument( ) throws OptionException
+ public void testProcessArgument( ) throws OptionException
{
final Parent option = buildLibParent( );
final List args = list( "--lib=C:\\WINDOWS;C:\\WINNT;C:\\" );
@@ -313,7 +313,7 @@
*
* @throws OptionException DOCUMENT ME!
*/
- public void testValidate_Children( ) throws OptionException
+ public void testValidateChildren( ) throws OptionException
{
final Parent option = buildKParent( );
final WriteableCommandLine commandLine = commandLine( option, list(
) );
@@ -338,7 +338,7 @@
*
* @throws OptionException DOCUMENT ME!
*/
- public void testValidate_Argument( ) throws OptionException
+ public void testValidateArgument( ) throws OptionException
{
final Command option = CommandTest.buildLoginCommand( );
final WriteableCommandLine commandLine = commandLine( option, list(
) );
@@ -381,7 +381,7 @@
/**
* DOCUMENT ME!
*/
- public void testAppendUsage_NoArguments( )
+ public void testAppendUsageNoArguments( )
{
final Option option = buildComplexParent( );
final StringBuffer buffer = new StringBuffer( );
@@ -399,7 +399,7 @@
/**
* DOCUMENT ME!
*/
- public void testAppendUsage_NoChildren( )
+ public void testAppendUsageNoChildren( )
{
final Option option = buildComplexParent( );
final StringBuffer buffer = new StringBuffer( );
@@ -413,7 +413,7 @@
/**
* DOCUMENT ME!
*/
- public void testAppendUsage_NoArgumentsOrChildren( )
+ public void testAppendUsageNoArgumentsOrChildren( )
{
final Option option = buildComplexParent( );
final StringBuffer buffer = new StringBuffer( );
@@ -491,7 +491,7 @@
/**
* DOCUMENT ME!
*/
- public void testHelpLines_NoArgument( )
+ public void testHelpLinesNoArgument( )
{
final Option option = buildComplexParent( );
final Set settings = new HashSet( DisplaySetting.ALL );
@@ -526,7 +526,7 @@
/**
* DOCUMENT ME!
*/
- public void testHelpLines_NoChildren( )
+ public void testHelpLinesNoChildren( )
{
final Option option = buildComplexParent( );
final Set settings = new HashSet( DisplaySetting.ALL );
Modified:
trunk/main/util/cli/src/test/net/dpml/cli/option/PropertyOptionTest.java
===================================================================
--- trunk/main/util/cli/src/test/net/dpml/cli/option/PropertyOptionTest.java
2006-01-09 02:55:41 UTC (rev 890)
+++ trunk/main/util/cli/src/test/net/dpml/cli/option/PropertyOptionTest.java
2006-01-09 04:12:29 UTC (rev 891)
@@ -51,7 +51,7 @@
/**
* DOCUMENT ME!
*/
- public void testCanProcess_Null( )
+ public void testCanProcessNull( )
{
final Option option = new PropertyOption( );
assertFalse( option.canProcess(
@@ -61,7 +61,7 @@
/**
* DOCUMENT ME!
*/
- public void testCanProcess_TooShort( )
+ public void testCanProcessTooShort( )
{
final Option option = new PropertyOption( );
assertFalse( option.canProcess(
@@ -71,7 +71,7 @@
/**
* DOCUMENT ME!
*/
- public void testCanProcess_BadMatch( )
+ public void testCanProcessBadMatch( )
{
final Option option = new PropertyOption( );
assertFalse( option.canProcess(
@@ -118,7 +118,7 @@
/**
* DOCUMENT ME!
*/
- public void testProcess_UnexpectedOptionException( )
+ public void testProcessUnexpectedOptionException( )
{
final Option option = new PropertyOption( );
final List args = list( "--help" );
@@ -143,7 +143,7 @@
*
* @throws OptionException DOCUMENT ME!
*/
- public void testProcess_BadPropertyException( ) throws OptionException
+ public void testProcessBadPropertyException( ) throws OptionException
{
final Option option = new PropertyOption( );
final List args = list( "-Dmyprop" );
@@ -160,7 +160,7 @@
*
* @throws OptionException DOCUMENT ME!
*/
- public void testProcess_SetToEmpty( ) throws OptionException
+ public void testProcessSetToEmpty( ) throws OptionException
{
final Option option = new PropertyOption( );
final List args = list( "-Dmyprop=" );
@@ -230,7 +230,7 @@
/**
* DOCUMENT ME!
*/
- public void testAppendUsage_Hidden( )
+ public void testAppendUsageHidden( )
{
final Option option = new PropertyOption( );
final StringBuffer buffer = new StringBuffer( );
@@ -299,7 +299,7 @@
/**
* DOCUMENT ME!
*/
- public void testHelpLines_NoDisplay( )
+ public void testHelpLinesNoDisplay( )
{
final Option option = new PropertyOption( );
final Set settings = new HashSet( DisplaySetting.ALL );
Modified: trunk/main/util/cli/src/test/net/dpml/cli/option/SwitchTest.java
===================================================================
--- trunk/main/util/cli/src/test/net/dpml/cli/option/SwitchTest.java
2006-01-09 02:55:41 UTC (rev 890)
+++ trunk/main/util/cli/src/test/net/dpml/cli/option/SwitchTest.java
2006-01-09 04:12:29 UTC (rev 891)
@@ -83,7 +83,7 @@
*
* @throws OptionException DOCUMENT ME!
*/
- public void testProcessParent_Disabled( ) throws OptionException
+ public void testProcessParentDisabled( ) throws OptionException
{
final Switch option = buildDisplaySwitch( );
final List args = list( "-disp" );
@@ -117,7 +117,7 @@
/**
* DOCUMENT ME!
*/
- public void testCanProcess_BadMatch( )
+ public void testCanProcessBadMatch( )
{
final Switch option = buildDisplaySwitch( );
assertFalse( option.canProcess(
@@ -211,7 +211,7 @@
/**
* DOCUMENT ME!
*/
- public void testAppendUsage_NoAlias( )
+ public void testAppendUsageNoAlias( )
{
final Option option = buildDisplaySwitch( );
final StringBuffer buffer = new StringBuffer( );
@@ -225,7 +225,7 @@
/**
* DOCUMENT ME!
*/
- public void testAppendUsage_NoDisabled( )
+ public void testAppendUsageNoDisabled( )
{
final Option option = buildDisplaySwitch( );
final StringBuffer buffer = new StringBuffer( );
@@ -239,7 +239,7 @@
/**
* DOCUMENT ME!
*/
- public void testAppendUsage_NoEnabled( )
+ public void testAppendUsageNoEnabled( )
{
final Option option = buildDisplaySwitch( );
final StringBuffer buffer = new StringBuffer( );
@@ -253,7 +253,7 @@
/**
* DOCUMENT ME!
*/
- public void testAppendUsage_NoDisabledOrEnabled( )
+ public void testAppendUsageNoDisabledOrEnabled( )
{
final Option option = buildDisplaySwitch( );
final StringBuffer buffer = new StringBuffer( );
@@ -427,15 +427,11 @@
}
}
- /*
- * (non-Javadoc)
- *
- * @see net.dpml.cli.OptionTestCase#testHelpLines()
- */
- /**
- * DOCUMENT ME!
- */
- public void testHelpLines( )
+ /**
+ * Test help lines.
+ * @see net.dpml.cli.OptionTestCase#testHelpLines()
+ */
+ public void testHelpLines()
{
// TODO Auto-generated method stub
}
Modified:
trunk/main/util/cli/src/test/net/dpml/cli/resource/ResourceHelperTest.java
===================================================================
---
trunk/main/util/cli/src/test/net/dpml/cli/resource/ResourceHelperTest.java
2006-01-09 02:55:41 UTC (rev 890)
+++
trunk/main/util/cli/src/test/net/dpml/cli/resource/ResourceHelperTest.java
2006-01-09 04:12:29 UTC (rev 891)
@@ -17,8 +17,6 @@
import junit.framework.TestCase;
-import java.util.Locale;
-import java.util.MissingResourceException;
import java.util.ResourceBundle;
/**
@@ -30,15 +28,13 @@
{
/** system property */
private static final String PROP_LOCALE = "net.dpml.cli.resource.bundle";
- private static ResourceHelper helper;
+ private static ResourceHelper m_HELPER;
- /** resource bundle */
- private ResourceBundle bundle;
+ /** resource m_bundle */
+ private ResourceBundle m_bundle;
/**
- * Create a new ResourceHelper for the specified class.
- *
- * @param clazz the Class that requires some resources
+ * Create a new ResourceHelperTest.
*/
public ResourceHelperTest( )
{
@@ -51,7 +47,7 @@
public void setUp( )
{
System.setProperty( PROP_LOCALE, "net.dpml.cli.resource.TestBundle"
);
- helper = ResourceHelper.getResourceHelper( );
+ m_HELPER = ResourceHelper.getResourceHelper( );
}
/**
@@ -70,7 +66,7 @@
{
assertEquals( "wrong message",
"The class name \"ResourceHelper\" is invalid.",
- helper.getMessage( "ClassValidator.bad.classname",
"ResourceHelper" ) );
+ m_HELPER.getMessage( "ClassValidator.bad.classname",
"ResourceHelper" ) );
}
/**
@@ -80,7 +76,7 @@
{
assertEquals( "wrong message",
"Some might say we will find a brighter day.",
- helper.getMessage( "test.message" ) );
+ m_HELPER.getMessage( "test.message" ) );
}
/**
@@ -90,7 +86,7 @@
{
assertEquals( "wrong message",
"Some might say we will find a brighter day.",
- helper.getMessage( "test.message", "Some" ) );
+ m_HELPER.getMessage( "test.message", "Some" ) );
}
/**
@@ -100,7 +96,7 @@
{
assertEquals( "wrong message",
"Some might say we will find a brighter day.",
- helper.getMessage( "test.message", "Some", "might" ) );
+ m_HELPER.getMessage( "test.message", "Some", "might" ) );
}
/**
@@ -110,7 +106,7 @@
{
assertEquals( "wrong message",
"Some might say we will find a brighter day.",
- helper.getMessage( "test.message", "Some", "might", "say" ) );
+ m_HELPER.getMessage( "test.message", "Some", "might", "say" ) );
}
/**
@@ -119,9 +115,9 @@
public void testDefaultBundle( )
{
System.setProperty( PROP_LOCALE, "madeupname.properties" );
- helper = ResourceHelper.getResourceHelper( );
+ m_HELPER = ResourceHelper.getResourceHelper( );
assertEquals( "wrong message",
"The class name \"ResourceHelper\" is invalid.",
- helper.getMessage( "ClassValidator.bad.classname",
"ResourceHelper" ) );
+ m_HELPER.getMessage( "ClassValidator.bad.classname",
"ResourceHelper" ) );
}
}
Modified: trunk/main/util/cli/src/test/net/dpml/cli/util/ComparatorsTest.java
===================================================================
--- trunk/main/util/cli/src/test/net/dpml/cli/util/ComparatorsTest.java
2006-01-09 02:55:41 UTC (rev 890)
+++ trunk/main/util/cli/src/test/net/dpml/cli/util/ComparatorsTest.java
2006-01-09 04:12:29 UTC (rev 891)
@@ -15,8 +15,6 @@
*/
package net.dpml.cli.util;
-import junit.framework.TestCase;
-
import net.dpml.cli.AbstractCLITestCase;
import net.dpml.cli.Option;
import net.dpml.cli.option.CommandTest;
Modified:
trunk/main/util/cli/src/test/net/dpml/cli/util/HelpFormatterTest.java
===================================================================
--- trunk/main/util/cli/src/test/net/dpml/cli/util/HelpFormatterTest.java
2006-01-09 02:55:41 UTC (rev 890)
+++ trunk/main/util/cli/src/test/net/dpml/cli/util/HelpFormatterTest.java
2006-01-09 04:12:29 UTC (rev 891)
@@ -15,6 +15,17 @@
*/
package net.dpml.cli.util;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
import junit.framework.TestCase;
import net.dpml.cli.DisplaySetting;
@@ -28,19 +39,6 @@
import net.dpml.cli.resource.ResourceConstants;
import net.dpml.cli.resource.ResourceHelper;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringReader;
-import java.io.StringWriter;
-
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
/**
* DOCUMENT ME!
*
@@ -49,41 +47,45 @@
*/
public class HelpFormatterTest extends TestCase
{
- private ResourceHelper resources = ResourceHelper.getResourceHelper( );
- private HelpFormatter helpFormatter;
- private Option verbose;
- private Group options;
+ private ResourceHelper m_resources = ResourceHelper.getResourceHelper(
);
+ private HelpFormatter m_helpFormatter;
+ private Option m_verbose;
+ private Group m_options;
/**
- * DOCUMENT ME!
+ * Test case setup.
*/
- public void setUp( )
+ public void setUp()
{
- helpFormatter = new HelpFormatter( "|*", "*-*", "*|", 80 );
- helpFormatter.setDivider(
+ m_helpFormatter = new HelpFormatter( "|*", "*-*", "*|", 80 );
+ m_helpFormatter.setDivider(
"+------------------------------------------------------------------------------+"
);
- helpFormatter.setHeader( "Jakarta Commons CLI" );
- helpFormatter.setFooter( "Copyright 2003\nApache Software
Foundation" );
- helpFormatter.setShellCommand( "ant" );
+ m_helpFormatter.setHeader( "Jakarta Commons CLI" );
+ m_helpFormatter.setFooter( "Copyright 2003\nApache Software
Foundation" );
+ m_helpFormatter.setShellCommand( "ant" );
- verbose = new DefaultOptionBuilder( ).withLongName( "verbose" )
- .withDescription( "print the
version information and exit" )
- .create( );
+ m_verbose =
+ new DefaultOptionBuilder( )
+ .withLongName( "verbose" )
+ .withDescription( "print the version information and exit" )
+ .create( );
- options = new GroupBuilder( ).withName( "options" )
- .withOption(
DefaultOptionTest.buildHelpOption( ) )
- .withOption(
ArgumentTest.buildTargetsArgument( ) )
- .withOption( new DefaultOptionBuilder(
).withLongName(
- "diagnostics" )
-
.withDescription( "print information that might be helpful to diagnose or
report problems." )
-
.create( ) )
- .withOption( new DefaultOptionBuilder(
).withLongName(
- "projecthelp" )
-
.withDescription( "print project help information" )
-
.create( ) )
- .withOption( verbose ).create( );
-
- helpFormatter.setGroup( options );
+ m_options =
+ new GroupBuilder( )
+ .withName( "options" )
+ .withOption( DefaultOptionTest.buildHelpOption( ) )
+ .withOption( ArgumentTest.buildTargetsArgument( ) )
+ .withOption(
+ new DefaultOptionBuilder( )
+ .withLongName( "diagnostics" )
+ .withDescription( "print information that might be helpful
to diagnose or report problems." )
+ .create( ) )
+ .withOption( new DefaultOptionBuilder( )
+ .withLongName( "projecthelp" )
+ .withDescription( "print project help information" )
+ .create( ) )
+ .withOption( m_verbose ).create( );
+ m_helpFormatter.setGroup( m_options );
}
/**
@@ -95,45 +97,45 @@
{
final StringWriter writer = new StringWriter( );
final PrintWriter pw = new PrintWriter( writer );
- helpFormatter.setPrintWriter( pw );
- helpFormatter.print( );
+ m_helpFormatter.setPrintWriter( pw );
+ m_helpFormatter.print( );
// test shell
assertEquals( "incorrect shell command", "ant",
- helpFormatter.getShellCommand( ) );
+ m_helpFormatter.getShellCommand( ) );
// test group
- assertEquals( "incorrect group", this.options,
- helpFormatter.getGroup( ) );
+ assertEquals( "incorrect group", this.m_options,
+ m_helpFormatter.getGroup( ) );
// test pagewidth
- assertEquals( "incorrect page width", 76,
helpFormatter.getPageWidth( ) );
+ assertEquals( "incorrect page width", 76,
m_helpFormatter.getPageWidth( ) );
// test pw
assertEquals( "incorrect print writer", pw,
- helpFormatter.getPrintWriter( ) );
+ m_helpFormatter.getPrintWriter( ) );
// test divider
assertEquals( "incorrect divider",
"+------------------------------------------------------------------------------+",
- helpFormatter.getDivider( ) );
+ m_helpFormatter.getDivider( ) );
// test header
assertEquals( "incorrect header", "Jakarta Commons CLI",
- helpFormatter.getHeader( ) );
+ m_helpFormatter.getHeader( ) );
// test footer
assertEquals( "incorrect footer",
"Copyright 2003\nApache Software Foundation",
- helpFormatter.getFooter( ) );
+ m_helpFormatter.getFooter( ) );
// test gutters
assertEquals( "incorrect left gutter", "|*",
- helpFormatter.getGutterLeft( ) );
+ m_helpFormatter.getGutterLeft( ) );
assertEquals( "incorrect right gutter", "*|",
- helpFormatter.getGutterRight( ) );
+ m_helpFormatter.getGutterRight( ) );
assertEquals( "incorrect center gutter", "*-*",
- helpFormatter.getGutterCenter( ) );
+ m_helpFormatter.getGutterCenter( ) );
final BufferedReader reader = new BufferedReader( new StringReader(
writer.toString( ) ) );
@@ -185,15 +187,15 @@
{
final StringWriter writer = new StringWriter( );
final PrintWriter pw = new PrintWriter( writer );
- helpFormatter.setPrintWriter( pw );
+ m_helpFormatter.setPrintWriter( pw );
final Comparator comparator = new OptionComparator( );
- helpFormatter.setComparator( comparator );
- helpFormatter.print( );
+ m_helpFormatter.setComparator( comparator );
+ m_helpFormatter.print( );
// test comparator
assertEquals( "invalid comparator", comparator,
- helpFormatter.getComparator( ) );
+ m_helpFormatter.getComparator( ) );
final BufferedReader reader = new BufferedReader( new StringReader(
writer.toString( ) ) );
@@ -244,8 +246,8 @@
public void testPrintHelp( ) throws IOException
{
final StringWriter writer = new StringWriter( );
- helpFormatter.setPrintWriter( new PrintWriter( writer ) );
- helpFormatter.printHelp( );
+ m_helpFormatter.setPrintWriter( new PrintWriter( writer ) );
+ m_helpFormatter.printHelp( );
final BufferedReader reader = new BufferedReader( new StringReader(
writer.toString( ) ) );
@@ -275,12 +277,12 @@
*
* @throws IOException DOCUMENT ME!
*/
- public void testPrintHelp_WithException( ) throws IOException
+ public void testPrintHelpWithException( ) throws IOException
{
final StringWriter writer = new StringWriter( );
- helpFormatter.setPrintWriter( new PrintWriter( writer ) );
- helpFormatter.setException( new OptionException( verbose ) );
- helpFormatter.printHelp( );
+ m_helpFormatter.setPrintWriter( new PrintWriter( writer ) );
+ m_helpFormatter.setException( new OptionException( m_verbose ) );
+ m_helpFormatter.printHelp( );
//System.out.println(writer);
final BufferedReader reader = new BufferedReader( new StringReader(
@@ -299,13 +301,13 @@
*
* @throws IOException DOCUMENT ME!
*/
- public void testPrintHelp_TooNarrow( ) throws IOException
+ public void testPrintHelpTooNarrow( ) throws IOException
{
final StringWriter writer = new StringWriter( );
- helpFormatter = new HelpFormatter( "<", "=", ">", 4 );
- helpFormatter.setGroup( options );
- helpFormatter.setPrintWriter( new PrintWriter( writer ) );
- helpFormatter.printHelp( );
+ m_helpFormatter = new HelpFormatter( "<", "=", ">", 4 );
+ m_helpFormatter.setGroup( m_options );
+ m_helpFormatter.setPrintWriter( new PrintWriter( writer ) );
+ m_helpFormatter.printHelp( );
final BufferedReader reader = new BufferedReader( new StringReader(
writer.toString( ) ) );
@@ -324,10 +326,10 @@
public void testPrintException( ) throws IOException
{
final StringWriter writer = new StringWriter( );
- helpFormatter.setPrintWriter( new PrintWriter( writer ) );
- helpFormatter.setException( new OptionException( verbose,
+ m_helpFormatter.setPrintWriter( new PrintWriter( writer ) );
+ m_helpFormatter.setException( new OptionException( m_verbose,
ResourceConstants.MISSING_OPTION ) );
- helpFormatter.printException( );
+ m_helpFormatter.printException( );
//System.out.println(writer);
final BufferedReader reader = new BufferedReader( new StringReader(
@@ -347,8 +349,8 @@
public void testPrintUsage( ) throws IOException
{
final StringWriter writer = new StringWriter( );
- helpFormatter.setPrintWriter( new PrintWriter( writer ) );
- helpFormatter.printUsage( );
+ m_helpFormatter.setPrintWriter( new PrintWriter( writer ) );
+ m_helpFormatter.printUsage( );
final BufferedReader reader = new BufferedReader( new StringReader(
writer.toString( ) ) );
@@ -371,8 +373,8 @@
public void testPrintHeader( ) throws IOException
{
final StringWriter writer = new StringWriter( );
- helpFormatter.setPrintWriter( new PrintWriter( writer ) );
- helpFormatter.printHeader( );
+ m_helpFormatter.setPrintWriter( new PrintWriter( writer ) );
+ m_helpFormatter.printHeader( );
final BufferedReader reader = new BufferedReader( new StringReader(
writer.toString( ) ) );
@@ -391,8 +393,8 @@
public void testPrintFooter( ) throws IOException
{
final StringWriter writer = new StringWriter( );
- helpFormatter.setPrintWriter( new PrintWriter( writer ) );
- helpFormatter.printFooter( );
+ m_helpFormatter.setPrintWriter( new PrintWriter( writer ) );
+ m_helpFormatter.printFooter( );
final BufferedReader reader = new BufferedReader( new StringReader(
writer.toString( ) ) );
@@ -413,8 +415,8 @@
public void testPrintDivider( ) throws IOException
{
final StringWriter writer = new StringWriter( );
- helpFormatter.setPrintWriter( new PrintWriter( writer ) );
- helpFormatter.printDivider( );
+ m_helpFormatter.setPrintWriter( new PrintWriter( writer ) );
+ m_helpFormatter.printDivider( );
final BufferedReader reader = new BufferedReader( new StringReader(
writer.toString( ) ) );
@@ -437,7 +439,7 @@
/**
* DOCUMENT ME!
*/
- public void testWrap_WrapNeeded( )
+ public void testWrapWrapNeeded( )
{
final Iterator i = HelpFormatter.wrap( "Apache Software Foundation",
20 )
.iterator( );
@@ -449,7 +451,7 @@
/**
* DOCUMENT ME!
*/
- public void testWrap_BeforeSpace( )
+ public void testWrapBeforeSpace( )
{
final Iterator i = HelpFormatter.wrap( "Apache Software Foundation",
16 )
.iterator( );
@@ -461,7 +463,7 @@
/**
* DOCUMENT ME!
*/
- public void testWrap_AfterSpace( )
+ public void testWrapAfterSpace( )
{
final Iterator i = HelpFormatter.wrap( "Apache Software Foundation",
17 )
.iterator( );
@@ -473,7 +475,7 @@
/**
* DOCUMENT ME!
*/
- public void testWrap_InWord( )
+ public void testWrapInWord( )
{
final Iterator i = HelpFormatter.wrap( "Apache Software Foundation",
8 )
.iterator( );
@@ -487,7 +489,7 @@
/**
* DOCUMENT ME!
*/
- public void testWrap_NewLine( )
+ public void testWrapNewLine( )
{
final Iterator i = HelpFormatter.wrap( "\nApache Software
Foundation\n",
30 ).iterator( );
@@ -496,15 +498,16 @@
assertEquals( "", i.next( ) );
assertFalse( i.hasNext( ) );
}
-
+
/**
* DOCUMENT ME!
*/
- public void testWrap_NewLine2( )
+ public void testWrapNewLine2( )
{
List wrapped = HelpFormatter.wrap(
- "A really quite long general description of the option with
specific alternatives documented:\n" +
- " Indented special case\n" + " Alternative scenario", 30 );
+ "A really quite long general description of the option with
specific alternatives documented:\n"
+ + " Indented special case\n"
+ + " Alternative scenario", 30 );
final Iterator i = wrapped.iterator( );
@@ -520,7 +523,7 @@
/**
* DOCUMENT ME!
*/
- public void testWrap_Below1Length( )
+ public void testWrapBelow1Length( )
{
try
{
@@ -529,7 +532,7 @@
}
catch( IllegalArgumentException e )
{
- assertEquals( resources.getMessage(
+ assertEquals( m_resources.getMessage(
ResourceConstants.HELPFORMATTER_WIDTH_TOO_NARROW,
new Object[]{new Integer( -1 )} ), e.getMessage( ) );
}
@@ -552,7 +555,7 @@
*
* @throws IOException DOCUMENT ME!
*/
- public void testPad_Null( ) throws IOException
+ public void testPadNull( ) throws IOException
{
final StringWriter writer = new StringWriter( );
HelpFormatter.pad( null, 10, writer );
@@ -564,7 +567,7 @@
*
* @throws IOException DOCUMENT ME!
*/
- public void testPad_TooLong( ) throws IOException
+ public void testPadTooLong( ) throws IOException
{
final StringWriter writer = new StringWriter( );
HelpFormatter.pad( "hello world", 10, writer );
@@ -576,7 +579,7 @@
*
* @throws IOException DOCUMENT ME!
*/
- public void testPad_TooShort( ) throws IOException
+ public void testPadTooShort( ) throws IOException
{
final StringWriter writer = new StringWriter( );
HelpFormatter.pad( "hello world", -5, writer );
@@ -590,17 +593,17 @@
*/
public void testGutters( ) throws IOException
{
- helpFormatter = new HelpFormatter( null, null, null, 80 );
- helpFormatter.setShellCommand( "ant" );
+ m_helpFormatter = new HelpFormatter( null, null, null, 80 );
+ m_helpFormatter.setShellCommand( "ant" );
final Set lusage = new HashSet( );
lusage.add( DisplaySetting.DISPLAY_ALIASES );
lusage.add( DisplaySetting.DISPLAY_GROUP_NAME );
- helpFormatter.setLineUsageSettings( lusage );
+ m_helpFormatter.setLineUsageSettings( lusage );
// test line usage
assertEquals( "incorrect line usage", lusage,
- helpFormatter.getLineUsageSettings( ) );
+ m_helpFormatter.getLineUsageSettings( ) );
final Set fusage = new HashSet( );
fusage.add( DisplaySetting.DISPLAY_PARENT_CHILDREN );
@@ -615,50 +618,57 @@
fusage.add( DisplaySetting.DISPLAY_PARENT_CHILDREN );
fusage.add( DisplaySetting.DISPLAY_PARENT_ARGUMENT );
fusage.add( DisplaySetting.DISPLAY_OPTIONAL );
- helpFormatter.setFullUsageSettings( fusage );
+ m_helpFormatter.setFullUsageSettings( fusage );
// test line usage
assertEquals( "incorrect full usage", fusage,
- helpFormatter.getFullUsageSettings( ) );
+ m_helpFormatter.getFullUsageSettings( ) );
final Set dsettings = new HashSet( );
dsettings.add( DisplaySetting.DISPLAY_GROUP_NAME );
dsettings.add( DisplaySetting.DISPLAY_GROUP_EXPANDED );
dsettings.add( DisplaySetting.DISPLAY_GROUP_ARGUMENT );
- helpFormatter.setDisplaySettings( dsettings );
+ m_helpFormatter.setDisplaySettings( dsettings );
- verbose = new DefaultOptionBuilder( ).withLongName( "verbose" )
- .withDescription( "print the
version information and exit" )
- .create( );
+ m_verbose =
+ new DefaultOptionBuilder( )
+ .withLongName( "verbose" )
+ .withDescription( "print the version information and exit" )
+ .create( );
- options = new GroupBuilder( ).withName( "options" )
- .withOption(
DefaultOptionTest.buildHelpOption( ) )
- .withOption(
ArgumentTest.buildTargetsArgument( ) )
- .withOption( new DefaultOptionBuilder(
).withLongName(
- "diagnostics" )
-
.withDescription( "print information that might be helpful to diagnose or
report problems." )
-
.create( ) )
- .withOption( new DefaultOptionBuilder(
).withLongName(
- "projecthelp" )
-
.withDescription( "print project help information" )
-
.create( ) )
- .withOption( verbose ).create( );
+ m_options =
+ new GroupBuilder( )
+ .withName( "options" )
+ .withOption( DefaultOptionTest.buildHelpOption( ) )
+ .withOption( ArgumentTest.buildTargetsArgument( ) )
+ .withOption(
+ new DefaultOptionBuilder( )
+ .withLongName( "diagnostics" )
+ .withDescription( "print information that might be helpful
to diagnose or report problems." )
+ .create( ) )
+ .withOption(
+ new DefaultOptionBuilder( )
+ .withLongName( "projecthelp" )
+ .withDescription( "print project help information" )
+ .create( ) )
+ .withOption( m_verbose )
+ .create();
- helpFormatter.setGroup( options );
+ m_helpFormatter.setGroup( m_options );
// test default gutters
assertEquals( "incorrect left gutter",
- HelpFormatter.DEFAULT_GUTTER_LEFT, helpFormatter.getGutterLeft(
) );
+ HelpFormatter.DEFAULT_GUTTER_LEFT,
m_helpFormatter.getGutterLeft( ) );
assertEquals( "incorrect right gutter",
- HelpFormatter.DEFAULT_GUTTER_RIGHT,
helpFormatter.getGutterRight( ) );
+ HelpFormatter.DEFAULT_GUTTER_RIGHT,
m_helpFormatter.getGutterRight( ) );
assertEquals( "incorrect center gutter",
HelpFormatter.DEFAULT_GUTTER_CENTER,
- helpFormatter.getGutterCenter( ) );
+ m_helpFormatter.getGutterCenter( ) );
final StringWriter writer = new StringWriter( );
- helpFormatter.setPrintWriter( new PrintWriter( writer ) );
- helpFormatter.print( );
+ m_helpFormatter.setPrintWriter( new PrintWriter( writer ) );
+ m_helpFormatter.print( );
final BufferedReader reader = new BufferedReader( new StringReader(
writer.toString( ) ) );
@@ -684,7 +694,9 @@
}
}
-
+/**
+ * OptionComparator.
+ */
class OptionComparator implements Comparator
{
/**
Modified:
trunk/main/util/cli/src/test/net/dpml/cli/validation/ClassValidatorTest.java
===================================================================
---
trunk/main/util/cli/src/test/net/dpml/cli/validation/ClassValidatorTest.java
2006-01-09 02:55:41 UTC (rev 890)
+++
trunk/main/util/cli/src/test/net/dpml/cli/validation/ClassValidatorTest.java
2006-01-09 04:12:29 UTC (rev 891)
@@ -34,15 +34,15 @@
*/
public class ClassValidatorTest extends TestCase
{
- private final static ResourceHelper resources =
ResourceHelper.getResourceHelper( );
- private ClassValidator validator;
+ private static final ResourceHelper RESOURCES =
ResourceHelper.getResourceHelper( );
+ private ClassValidator m_validator;
/**
* DOCUMENT ME!
*/
protected void setUp( )
{
- validator = new ClassValidator( );
+ m_validator = new ClassValidator( );
}
/**
@@ -55,7 +55,7 @@
final Object[] array = new Object[]{"MyApp", "org.apache.ant.Main"};
final List list = Arrays.asList( array );
- validator.validate( list );
+ m_validator.validate( list );
assertEquals( "Name is incorrect", "MyApp", list.get( 0 ) );
assertEquals( "Name is incorrect", "org.apache.ant.Main", list.get(
1 ) );
@@ -72,12 +72,12 @@
try
{
- validator.validate( list );
+ m_validator.validate( list );
fail( "Class name cannot start with a number." );
}
catch( InvalidArgumentException ive )
{
- assertEquals( resources.getMessage(
+ assertEquals( RESOURCES.getMessage(
"ClassValidator.bad.classname", className ),
ive.getMessage( ) );
}
@@ -95,12 +95,12 @@
try
{
- validator.validate( list );
+ m_validator.validate( list );
fail( "Trailing period not permitted." );
}
catch( InvalidArgumentException ive )
{
- assertEquals( resources.getMessage(
+ assertEquals( RESOURCES.getMessage(
"ClassValidator.bad.classname", className ),
ive.getMessage( ) );
}
@@ -118,12 +118,12 @@
try
{
- validator.validate( list );
+ m_validator.validate( list );
fail( "Two consecutive periods is not permitted." );
}
catch( InvalidArgumentException ive )
{
- assertEquals( resources.getMessage(
+ assertEquals( RESOURCES.getMessage(
"ClassValidator.bad.classname", className ),
ive.getMessage( ) );
}
@@ -141,12 +141,12 @@
try
{
- validator.validate( list );
+ m_validator.validate( list );
fail( "Illegal character not allowed in Class name." );
}
catch( InvalidArgumentException ive )
{
- assertEquals( resources.getMessage(
+ assertEquals( RESOURCES.getMessage(
"ClassValidator.bad.classname", className ),
ive.getMessage( ) );
}
@@ -157,11 +157,11 @@
*/
public void testLoadable( )
{
- assertFalse( "Validator is loadable", validator.isLoadable( ) );
- validator.setLoadable( true );
- assertTrue( "Validator is NOT loadable", validator.isLoadable( ) );
- validator.setLoadable( false );
- assertFalse( "Validator is loadable", validator.isLoadable( ) );
+ assertFalse( "Validator is loadable", m_validator.isLoadable( ) );
+ m_validator.setLoadable( true );
+ assertTrue( "Validator is NOT loadable", m_validator.isLoadable( )
);
+ m_validator.setLoadable( false );
+ assertFalse( "Validator is loadable", m_validator.isLoadable( ) );
}
/**
@@ -172,13 +172,13 @@
public void testLoadValid( ) throws InvalidArgumentException
{
final Object[] array = new Object[]
- {
- "net.dpml.cli.Option", "java.util.Vector"
- };
+ {
+ "net.dpml.cli.Option", "java.util.Vector"
+ };
final List list = Arrays.asList( array );
- validator.setLoadable( true );
- validator.validate( list );
+ m_validator.setLoadable( true );
+ m_validator.validate( list );
final Iterator i = list.iterator( );
assertEquals( "net.dpml.cli.Option", ( (Class) i.next( ) ).getName(
) );
@@ -196,16 +196,16 @@
final Object[] array = new Object[]{className, "java.util.Vectors"};
final List list = Arrays.asList( array );
- validator.setLoadable( true );
+ m_validator.setLoadable( true );
try
{
- validator.validate( list );
+ m_validator.validate( list );
fail( "Class Not Found" );
}
catch( InvalidArgumentException ive )
{
- assertEquals( resources.getMessage(
+ assertEquals( RESOURCES.getMessage(
"ClassValidator.class.notfound", className ),
ive.getMessage( ) );
}
@@ -216,12 +216,12 @@
*/
public void testInstantiate( )
{
- assertFalse( "Validator creates instances", validator.isInstance( )
);
- validator.setInstance( true );
+ assertFalse( "Validator creates instances", m_validator.isInstance(
) );
+ m_validator.setInstance( true );
assertTrue( "Validator does NOT create instances",
- validator.isInstance( ) );
- validator.setInstance( false );
- assertFalse( "Validator creates instances", validator.isInstance( )
);
+ m_validator.isInstance( ) );
+ m_validator.setInstance( false );
+ assertFalse( "Validator creates instances", m_validator.isInstance(
) );
}
/**
@@ -234,9 +234,9 @@
final Object[] array = new Object[]{"java.util.Vector"};
final List list = Arrays.asList( array );
- validator.setInstance( true );
+ m_validator.setInstance( true );
- validator.validate( list );
+ m_validator.validate( list );
assertTrue( "Vector instance NOT found",
list.get( 0 ) instanceof java.util.Vector );
}
@@ -250,16 +250,16 @@
final Object[] array = new Object[]{className};
final List list = Arrays.asList( array );
- validator.setInstance( true );
+ m_validator.setInstance( true );
try
{
- validator.validate( list );
+ m_validator.validate( list );
fail( "It's not possible to create a '" + className + "'" );
}
catch( final InvalidArgumentException ive )
{
- assertEquals( resources.getMessage(
"ClassValidator.class.create",
+ assertEquals( RESOURCES.getMessage(
"ClassValidator.class.create",
className ), ive.getMessage( ) );
}
}
@@ -273,21 +273,22 @@
final Object[] array = new Object[]{className};
final List list = Arrays.asList( array );
- validator.setInstance( true );
+ m_validator.setInstance( true );
try
{
- validator.validate( list );
+ m_validator.validate( list );
fail( "It's not possible to create a '" + className + "'" );
}
catch( final InvalidArgumentException ive )
{
- assertEquals( resources.getMessage(
"ClassValidator.class.access",
+ assertEquals( RESOURCES.getMessage(
"ClassValidator.class.access",
className,
- "Class net.dpml.cli.validation.ClassValidator " +
- "can not access a member of class " +
- "net.dpml.cli.validation.protect.ProtectedClass " +
- "with modifiers \"protected\"" ), ive.getMessage( ) );
+ "Class net.dpml.cli.validation.ClassValidator "
+ + "can not access a member of class "
+ + "net.dpml.cli.validation.protect.ProtectedClass "
+ + "with modifiers \"protected\"" ),
+ ive.getMessage() );
}
}
@@ -297,13 +298,13 @@
public void testClassloader( )
{
assertEquals( "Wrong classloader found",
- validator.getClass( ).getClassLoader( ),
- validator.getClassLoader( ) );
+ m_validator.getClass( ).getClassLoader( ),
+ m_validator.getClassLoader( ) );
URLClassLoader classloader = new URLClassLoader( new URL[]{} );
- validator.setClassLoader( classloader );
+ m_validator.setClassLoader( classloader );
assertEquals( "Wrong classloader found", classloader,
- validator.getClassLoader( ) );
+ m_validator.getClassLoader( ) );
}
}
Modified:
trunk/main/util/cli/src/test/net/dpml/cli/validation/DateValidatorTest.java
===================================================================
---
trunk/main/util/cli/src/test/net/dpml/cli/validation/DateValidatorTest.java
2006-01-09 02:55:41 UTC (rev 890)
+++
trunk/main/util/cli/src/test/net/dpml/cli/validation/DateValidatorTest.java
2006-01-09 04:12:29 UTC (rev 891)
@@ -39,24 +39,24 @@
*/
public class DateValidatorTest extends TestCase
{
- private static final ResourceHelper resources =
ResourceHelper.getResourceHelper( );
+ private static final ResourceHelper RESOURCES =
ResourceHelper.getResourceHelper( );
/**
- * DOCUMENT ME!
+ * D M YY.
*/
public static final DateFormat D_M_YY = new SimpleDateFormat( "d/M/yy" );
/**
- * DOCUMENT ME!
+ * YYYY_MM_YY
*/
- public static final DateFormat YYYY_MM_YY = new SimpleDateFormat(
- "yyyy-MM-dd" );
- private List formats = Arrays.asList( new Object[]{D_M_YY, YYYY_MM_YY} );
+ public static final DateFormat YYYY_MM_YY = new SimpleDateFormat(
"yyyy-MM-dd" );
+
+ private List m_formats = Arrays.asList( new Object[]{D_M_YY, YYYY_MM_YY}
);
/**
- * DOCUMENT ME!
+ * Test single format validation.
*
- * @throws InvalidArgumentException DOCUMENT ME!
+ * @throws InvalidArgumentException if an error occurs
*/
public void testSingleFormatValidate( ) throws InvalidArgumentException
{
@@ -72,9 +72,9 @@
}
/**
- * DOCUMENT ME!
+ * Test default format validation.
*
- * @throws InvalidArgumentException DOCUMENT ME!
+ * @throws InvalidArgumentException if an error occurs
*/
public void testDefaultDateFormatValidate( )
throws InvalidArgumentException
@@ -95,9 +95,9 @@
}
/**
- * DOCUMENT ME!
+ * DTest default time format validation.
*
- * @throws InvalidArgumentException DOCUMENT ME!
+ * @throws InvalidArgumentException if an error occurs
*/
public void testDefaultTimeFormatValidate( )
throws InvalidArgumentException
@@ -118,9 +118,9 @@
}
/**
- * DOCUMENT ME!
+ * Test default date and time format validation.
*
- * @throws InvalidArgumentException DOCUMENT ME!
+ * @throws InvalidArgumentException if an error occurs
*/
public void testDefaultDateTimeFormatValidate( )
throws InvalidArgumentException
@@ -141,9 +141,9 @@
}
/**
- * DOCUMENT ME!
+ * Test default validator.
*
- * @throws InvalidArgumentException DOCUMENT ME!
+ * @throws InvalidArgumentException if an error occurs
*/
public void testDefaultValidator( ) throws InvalidArgumentException
{
@@ -163,15 +163,15 @@
}
/**
- * DOCUMENT ME!
+ * General validation test.
*
- * @throws InvalidArgumentException DOCUMENT ME!
+ * @throws InvalidArgumentException if an error occurs
*/
public void testValidate( ) throws InvalidArgumentException
{
final Object[] array = new Object[]{"23/12/03", "2002-10-12"};
final List list = Arrays.asList( array );
- final Validator validator = new DateValidator( formats );
+ final Validator validator = new DateValidator( m_formats );
validator.validate( list );
@@ -182,13 +182,13 @@
}
/**
- * DOCUMENT ME!
+ * Test minimum bounds.
*
- * @throws InvalidArgumentException DOCUMENT ME!
+ * @throws InvalidArgumentException if an error occurs
*/
public void testMinimumBounds( ) throws InvalidArgumentException
{
- final DateValidator validator = new DateValidator( formats );
+ final DateValidator validator = new DateValidator( m_formats );
final Calendar cal = Calendar.getInstance( );
{
@@ -219,7 +219,7 @@
}
catch( final InvalidArgumentException exp )
{
- assertEquals( resources.getMessage(
+ assertEquals( RESOURCES.getMessage(
ResourceConstants.DATEVALIDATOR_DATE_OUTOFRANGE,
new Object[]{"2002-10-12"} ), exp.getMessage( ) );
}
@@ -227,29 +227,29 @@
}
/**
- * DOCUMENT ME!
+ * Test formats.
*
- * @throws InvalidArgumentException DOCUMENT ME!
+ * @throws InvalidArgumentException if an error occurs
*/
public void testFormats( ) throws InvalidArgumentException
{
- final DateValidator validator = new DateValidator( formats );
+ final DateValidator validator = new DateValidator( m_formats );
assertEquals( "date format is incorrect",
- ( (SimpleDateFormat) formats.get( 0 ) ).toPattern( ),
+ ( (SimpleDateFormat) m_formats.get( 0 ) ).toPattern( ),
( (SimpleDateFormat) validator.getFormats( )[0] ).toPattern( )
);
assertEquals( "date format is incorrect",
- ( (SimpleDateFormat) formats.get( 1 ) ).toPattern( ),
+ ( (SimpleDateFormat) m_formats.get( 1 ) ).toPattern( ),
( (SimpleDateFormat) validator.getFormats( )[1] ).toPattern( )
);
}
/**
- * DOCUMENT ME!
+ * Test maximum bounds.
*
- * @throws InvalidArgumentException DOCUMENT ME!
+ * @throws InvalidArgumentException if an error occurs
*/
public void testMaximumBounds( ) throws InvalidArgumentException
{
- final DateValidator validator = new DateValidator( formats );
+ final DateValidator validator = new DateValidator( m_formats );
final Calendar cal = Calendar.getInstance( );
{
@@ -280,7 +280,7 @@
}
catch( final InvalidArgumentException exp )
{
- assertEquals( resources.getMessage(
+ assertEquals( RESOURCES.getMessage(
ResourceConstants.DATEVALIDATOR_DATE_OUTOFRANGE,
new Object[]{"2004-10-12"} ), exp.getMessage( ) );
}
@@ -288,15 +288,13 @@
}
/**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * Return the test source.
+ * @return the test
*/
public static Test suite( )
{
Test result = new TestSuite( DateValidatorTest.class ); // default
behavior
result = new TimeZoneTestSuite( "EST", result ); // ensure it runs
in EST timezone
-
return result;
}
}
Modified:
trunk/main/util/cli/src/test/net/dpml/cli/validation/EnumValidatorTest.java
===================================================================
---
trunk/main/util/cli/src/test/net/dpml/cli/validation/EnumValidatorTest.java
2006-01-09 02:55:41 UTC (rev 890)
+++
trunk/main/util/cli/src/test/net/dpml/cli/validation/EnumValidatorTest.java
2006-01-09 04:12:29 UTC (rev 891)
@@ -27,48 +27,49 @@
import java.util.TreeSet;
/**
- * DOCUMENT ME!
+ * EnumValidatorTest.
*
* @author $author$
* @version $Revision$
*/
public class EnumValidatorTest extends TestCase
{
- private final static ResourceHelper resources =
ResourceHelper.getResourceHelper( );
- private final Set enumSet = new TreeSet( Arrays.asList(
- new Object[]{"red", "green", "blue"} ) );
+ private static final ResourceHelper RESOURCES =
ResourceHelper.getResourceHelper( );
+ private final Set m_enumSet =
+ new TreeSet(
+ Arrays.asList( new Object[]{"red", "green", "blue"} ) );
/**
- * DOCUMENT ME!
+ * Test enum validation.
*
- * @throws InvalidArgumentException DOCUMENT ME!
+ * @throws InvalidArgumentException if an error occurs
*/
public void testValidate( ) throws InvalidArgumentException
{
final Object[] array = new Object[]{"red", "green"};
- {
- final List list = Arrays.asList( array );
- final EnumValidator validator = new EnumValidator( enumSet );
- assertEquals( "valid values are incorrect", enumSet,
- validator.getValidValues( ) );
- validator.validate( list );
+ final List list = Arrays.asList( array );
+ final EnumValidator validator = new EnumValidator( m_enumSet );
+ assertEquals(
+ "valid values are incorrect",
+ m_enumSet,
+ validator.getValidValues() );
+ validator.validate( list );
- final Iterator i = list.iterator( );
- assertEquals( "red", i.next( ) );
- assertEquals( "green", i.next( ) );
- assertFalse( i.hasNext( ) );
- }
+ final Iterator i = list.iterator( );
+ assertEquals( "red", i.next( ) );
+ assertEquals( "green", i.next( ) );
+ assertFalse( i.hasNext( ) );
}
/**
- * DOCUMENT ME!
+ * Test non-member.
*/
public void testNonMember( )
{
final Object[] array = new Object[]{"red", "pink"};
final List list = Arrays.asList( array );
- final EnumValidator validator = new EnumValidator( enumSet );
+ final EnumValidator validator = new EnumValidator( m_enumSet );
try
{
@@ -77,7 +78,7 @@
}
catch( InvalidArgumentException e )
{
- assertEquals( resources.getMessage(
+ assertEquals( RESOURCES.getMessage(
ResourceConstants.ENUM_ILLEGAL_VALUE,
new Object[]{"pink", validator.getValuesAsString( )} ),
e.getMessage( ) );
Modified:
trunk/main/util/cli/src/test/net/dpml/cli/validation/FileValidatorTest.java
===================================================================
---
trunk/main/util/cli/src/test/net/dpml/cli/validation/FileValidatorTest.java
2006-01-09 02:55:41 UTC (rev 890)
+++
trunk/main/util/cli/src/test/net/dpml/cli/validation/FileValidatorTest.java
2006-01-09 04:12:29 UTC (rev 891)
@@ -15,15 +15,13 @@
*/
package net.dpml.cli.validation;
-import junit.framework.TestCase;
-
import java.io.File;
-import java.io.IOException;
-
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
+import junit.framework.TestCase;
+
/**
* JUnit test case for the FileValidator.
*
@@ -59,7 +57,7 @@
/**
* DOCUMENT ME!
*/
- public void testValidate_Directory( )
+ public void testValidateDirectory( )
{
final Object[] array = new Object[]{"src", "build.xml"};
final List list = Arrays.asList( array );
@@ -84,7 +82,7 @@
/**
* DOCUMENT ME!
*/
- public void testValidate_ReadableFile( )
+ public void testValidateReadableFile( )
{
// make file readonly
File file = new File( "target/test/data/readable.txt" );
@@ -92,8 +90,8 @@
if( !file.exists( ) )
{
throw new IllegalStateException(
- "Missing test resource: 'target/test/data/readable.txt'
relative to " +
- System.getProperty( "user.dir" ) );
+ "Missing test resource: 'target/test/data/readable.txt'
relative to "
+ + System.getProperty( "user.dir" ) );
}
file.setReadOnly( );
@@ -129,7 +127,7 @@
/**
* DOCUMENT ME!
*/
- public void testValidate_WritableFile( )
+ public void testValidateWritableFile( )
{
// make file readonly
File file = new File( "target/test/data/readable.txt" );
@@ -166,7 +164,7 @@
/**
* DOCUMENT ME!
*/
- public void testValidate_Existing( )
+ public void testValidateExisting( )
{
final Object[] array = new Object[]{"build.xml",
"veryunlikelyfilename"};
final List list = Arrays.asList( array );
@@ -191,7 +189,7 @@
/**
* DOCUMENT ME!
*/
- public void testValidate_File( )
+ public void testValidateFile( )
{
final Object[] array = new Object[]{"build.xml", "src"};
final List list = Arrays.asList( array );
Modified:
trunk/main/util/cli/src/test/net/dpml/cli/validation/NumberValidatorTest.java
===================================================================
---
trunk/main/util/cli/src/test/net/dpml/cli/validation/NumberValidatorTest.java
2006-01-09 02:55:41 UTC (rev 890)
+++
trunk/main/util/cli/src/test/net/dpml/cli/validation/NumberValidatorTest.java
2006-01-09 04:12:29 UTC (rev 891)
@@ -34,35 +34,31 @@
*/
public class NumberValidatorTest extends TestCase
{
- private static final ResourceHelper resources =
ResourceHelper.getResourceHelper( );
+ private static final ResourceHelper RESOURCES =
ResourceHelper.getResourceHelper();
/**
* DOCUMENT ME!
*
* @throws InvalidArgumentException DOCUMENT ME!
*/
- public void testValidate_Number( ) throws InvalidArgumentException
+ public void testValidateNumber( ) throws InvalidArgumentException
{
final NumberFormat format = NumberFormat.getNumberInstance( );
- final Object[] array = new Object[]
- {
- format.format( 1d ), format.format( 1.07d ),
- format.format( -.45d )
- };
+ final Object[] array = new Object[]{
+ format.format( 1d ), format.format( 1.07d ),
+ format.format( -.45d )};
- {
- final List list = Arrays.asList( array );
- final Validator validator = NumberValidator.getNumberInstance(
);
+ final List list = Arrays.asList( array );
+ final Validator validator = NumberValidator.getNumberInstance( );
- validator.validate( list );
+ validator.validate( list );
- final Iterator i = list.iterator( );
- assertEquals( 1d, ( (Number) i.next( ) ).doubleValue( ),
0.0001 );
- assertEquals( 1.07d, ( (Number) i.next( ) ).doubleValue( ),
0.0001 );
- assertEquals( -.45d, ( (Number) i.next( ) ).doubleValue( ),
0.0001 );
- assertFalse( i.hasNext( ) );
- }
+ final Iterator i = list.iterator( );
+ assertEquals( 1d, ( (Number) i.next( ) ).doubleValue( ), 0.0001 );
+ assertEquals( 1.07d, ( (Number) i.next( ) ).doubleValue( ), 0.0001
);
+ assertEquals( -.45d, ( (Number) i.next( ) ).doubleValue( ), 0.0001
);
+ assertFalse( i.hasNext( ) );
}
/**
@@ -70,27 +66,22 @@
*
* @throws InvalidArgumentException DOCUMENT ME!
*/
- public void testValidate_Currency( ) throws InvalidArgumentException
+ public void testValidateCurrency( ) throws InvalidArgumentException
{
NumberFormat format = NumberFormat.getCurrencyInstance( );
- final Object[] array = new Object[]
- {
- format.format( 1d ), format.format( 1.07 ),
- format.format( -0.45 )
- };
+ final Object[] array = new Object[]{
+ format.format( 1d ), format.format( 1.07 ),
+ format.format( -0.45 )};
final List list = Arrays.asList( array );
-
final NumberValidator validator =
NumberValidator.getCurrencyInstance( );
assertEquals( "incorrect currency format", format,
validator.getFormat( ) );
-
validator.validate( list );
-
final Iterator i = list.iterator( );
assertEquals( 1d, ( (Number) i.next( ) ).doubleValue( ), 0.0001 );
assertEquals( 1.07d, ( (Number) i.next( ) ).doubleValue( ), 0.0001
);
assertEquals( -.45d, ( (Number) i.next( ) ).doubleValue( ), 0.0001
);
- assertFalse( i.hasNext( ) );
+ assertFalse( i.hasNext() );
}
/**
@@ -98,15 +89,15 @@
*
* @throws InvalidArgumentException DOCUMENT ME!
*/
- public void testValidate_Percent( ) throws InvalidArgumentException
+ public void testValidatePercent( ) throws InvalidArgumentException
{
final NumberFormat format = NumberFormat.getPercentInstance( );
final Object[] array = new Object[]
- {
- format.format( .01 ), format.format( 1.07 ),
- format.format( -.45 ), format.format( 0.001 )
- };
+ {
+ format.format( .01 ), format.format( 1.07 ),
+ format.format( -.45 ), format.format( 0.001 )
+ };
final List list = Arrays.asList( array );
final Validator validator = NumberValidator.getPercentInstance( );
@@ -125,14 +116,12 @@
*
* @throws InvalidArgumentException DOCUMENT ME!
*/
- public void testValidate_Integer( ) throws InvalidArgumentException
+ public void testValidateInteger( ) throws InvalidArgumentException
{
final Object[] array = new Object[]{"1", "107", "-45"};
final List list = Arrays.asList( array );
final Validator validator = NumberValidator.getIntegerInstance( );
-
validator.validate( list );
-
final Iterator i = list.iterator( );
assertEquals( 1d, ( (Number) i.next( ) ).doubleValue( ), 0.0001 );
assertEquals( 107d, ( (Number) i.next( ) ).doubleValue( ), 0.0001
);
@@ -143,7 +132,7 @@
/**
* DOCUMENT ME!
*/
- public void testValidate_ExcessChars( )
+ public void testValidateExcessChars( )
{
final Object[] array = new Object[]{"10DowningStreet"};
final List list = Arrays.asList( array );
@@ -163,7 +152,7 @@
/**
* DOCUMENT ME!
*/
- public void testValidate_Maximum( )
+ public void testValidateMaximum( )
{
final Object[] array = new Object[]{"1", "107"};
final List list = Arrays.asList( array );
@@ -182,7 +171,7 @@
}
catch( InvalidArgumentException ive )
{
- assertEquals( resources.getMessage(
+ assertEquals( RESOURCES.getMessage(
ResourceConstants.NUMBERVALIDATOR_NUMBER_OUTOFRANGE,
"107" ),
ive.getMessage( ) );
}
@@ -191,7 +180,7 @@
/**
* DOCUMENT ME!
*/
- public void testValidate_Minimum( )
+ public void testValidateMinimum( )
{
final Object[] array = new Object[]{"107", "1"};
final List list = Arrays.asList( array );
@@ -209,7 +198,7 @@
}
catch( InvalidArgumentException ive )
{
- assertEquals( resources.getMessage(
+ assertEquals( RESOURCES.getMessage(
ResourceConstants.NUMBERVALIDATOR_NUMBER_OUTOFRANGE, "1"
),
ive.getMessage( ) );
}
Modified:
trunk/main/util/cli/src/test/net/dpml/cli/validation/TimeZoneTestSuite.java
===================================================================
---
trunk/main/util/cli/src/test/net/dpml/cli/validation/TimeZoneTestSuite.java
2006-01-09 02:55:41 UTC (rev 890)
+++
trunk/main/util/cli/src/test/net/dpml/cli/validation/TimeZoneTestSuite.java
2006-01-09 04:12:29 UTC (rev 891)
@@ -30,8 +30,8 @@
*/
public class TimeZoneTestSuite extends TestDecorator
{
- private final TimeZone timeZone;
- private final TimeZone originalTimeZone;
+ private final TimeZone m_timeZone;
+ private final TimeZone m_originalTimeZone;
/**
* Creates a new TimeZoneTestSuite object.
@@ -42,8 +42,8 @@
public TimeZoneTestSuite( String timeZone, Test test )
{
super( test );
- this.timeZone = TimeZone.getTimeZone( timeZone );
- this.originalTimeZone = TimeZone.getDefault( );
+ m_timeZone = TimeZone.getTimeZone( timeZone );
+ m_originalTimeZone = TimeZone.getDefault();
}
/**
@@ -55,12 +55,12 @@
{
try
{
- TimeZone.setDefault( timeZone );
+ TimeZone.setDefault( m_timeZone );
super.run( testResult );
}
finally
{
- TimeZone.setDefault( originalTimeZone ); // cleanup
+ TimeZone.setDefault( m_originalTimeZone ); // cleanup
}
}
}
Modified:
trunk/main/util/cli/src/test/net/dpml/cli/validation/URLValidatorTest.java
===================================================================
---
trunk/main/util/cli/src/test/net/dpml/cli/validation/URLValidatorTest.java
2006-01-09 02:55:41 UTC (rev 890)
+++
trunk/main/util/cli/src/test/net/dpml/cli/validation/URLValidatorTest.java
2006-01-09 04:12:29 UTC (rev 891)
@@ -35,7 +35,7 @@
*/
public class URLValidatorTest extends TestCase
{
- private static final ResourceHelper resources =
ResourceHelper.getResourceHelper( );
+ private static final ResourceHelper RESOURCES =
ResourceHelper.getResourceHelper( );
/**
* DOCUMENT ME!
@@ -80,7 +80,7 @@
}
catch( InvalidArgumentException e )
{
- assertEquals( resources.getMessage(
+ assertEquals( RESOURCES.getMessage(
ResourceConstants.URLVALIDATOR_MALFORMED_URL,
new Object[]{"www.apache.org"} ), e.getMessage( ) );
}
@@ -91,46 +91,48 @@
*/
public void testBadProtocol( )
{
+ final Object[] array = new Object[]
{
- final Object[] array = new Object[]
- {
- "http://www.apache.org/", "file:///etc"
- };
- final List list = Arrays.asList( array );
- final URLValidator validator = new URLValidator( );
- validator.setProtocol( "http" );
+ "http://www.apache.org/", "file:///etc"
+ };
+ final List list = Arrays.asList( array );
+ final URLValidator validator = new URLValidator( );
+ validator.setProtocol( "http" );
- assertEquals( "incorrect protocol", "http",
- validator.getProtocol( ) );
+ assertEquals( "incorrect protocol", "http",
+ validator.getProtocol( ) );
- try
- {
- validator.validate( list );
- fail( "Expected InvalidArgumentException" );
- }
- catch( InvalidArgumentException e )
- {
- assertEquals( "file:///etc", e.getMessage( ) );
- }
+ try
+ {
+ validator.validate( list );
+ fail( "Expected InvalidArgumentException" );
}
+ catch( InvalidArgumentException e )
+ {
+ assertEquals( "file:///etc", e.getMessage( ) );
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ public void testBadProtocol2( )
+ {
+ final Object[] array = new Object[]
+ {
+ "http://www.apache.org/", "file:///etc"
+ };
+ final List list = Arrays.asList( array );
+ final URLValidator validator = new URLValidator( "http" );
+ try
{
- final Object[] array = new Object[]
- {
- "http://www.apache.org/", "file:///etc"
- };
- final List list = Arrays.asList( array );
- final URLValidator validator = new URLValidator( "http" );
-
- try
- {
- validator.validate( list );
- fail( "Expected InvalidArgumentException" );
- }
- catch( InvalidArgumentException e )
- {
- assertEquals( "file:///etc", e.getMessage( ) );
- }
+ validator.validate( list );
+ fail( "Expected InvalidArgumentException" );
}
+ catch( InvalidArgumentException e )
+ {
+ assertEquals( "file:///etc", e.getMessage( ) );
+ }
}
}
Modified:
trunk/main/util/cli/src/test/net/dpml/cli/validation/protect/ProtectedClass.java
===================================================================
---
trunk/main/util/cli/src/test/net/dpml/cli/validation/protect/ProtectedClass.java
2006-01-09 02:55:41 UTC (rev 890)
+++
trunk/main/util/cli/src/test/net/dpml/cli/validation/protect/ProtectedClass.java
2006-01-09 04:12:29 UTC (rev 891)
@@ -15,6 +15,9 @@
*/
package net.dpml.cli.validation.protect;
+/**
+ * Dummy class declared as package private.
+ */
class ProtectedClass
{
/**
- r891 - in trunk/main/util/cli/src/test/net/dpml/cli: . commandline option resource util validation validation/protect, mcconnell at BerliOS, 01/08/2006
Archive powered by MHonArc 2.6.24.