System.setProperty( "testlong", "32" ); //$NON-NLS-1$//$NON-NLS-2$
System.setProperty( "testdecimal", "66.6" ); //$NON-NLS-1$//$NON-NLS-2$
Date someDate = new Date();
System.setProperty( "testdate", DateFormat.getInstance().format( someDate ) ); //$NON-NLS-1$
JVMParameterProvider provider = new JVMParameterProvider();
// assertEquals(someDate, provider.getDateParameter("testdate", null) ); //$NON-NLS-1$
assertEquals( someDate, provider.getDateParameter( "bogus", someDate ) ); //$NON-NLS-1$
assertEquals( 32, provider.getLongParameter( "testlong", 0 ) ); //$NON-NLS-1$
assertEquals( "test string", provider.getStringParameter( "teststring", null ) ); //$NON-NLS-1$ //$NON-NLS-2$
assertEquals( new BigDecimal( "66.6" ), provider.getDecimalParameter( "testdecimal", null ) ); //$NON-NLS-1$ //$NON-NLS-2$
assertEquals( "test string", provider.getParameter( "teststring" ) ); //$NON-NLS-1$ //$NON-NLS-2$
assertEquals( "string", provider.getParameterType( "teststring" ) ); //$NON-NLS-1$ //$NON-NLS-2$
Iterator it = provider.getParameterNames();
while ( it.hasNext() ) {
String pName = (String) it.next();
System.out.println( pName + "=" + provider.getStringParameter( pName, null ) ); //$NON-NLS-1$
}
finishTest();
}