public void testArrays() {
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put( "int-1", new Object[] { new Integer( 100 ) } );
paramMap.put( "int-2", new Object[] { new Integer( 100 ), new Integer( 999 ) } );
SimpleParameterProvider params = new SimpleParameterProvider();
params.copyAndConvertParameters( paramMap );
assertEquals( "param value is wrong", "100", params.getStringParameter( "int-1", null ) );
assertEquals( "param value is wrong", 100, params.getLongParameter( "int-1", -1 ) );
assertEquals( "param value is wrong", "100", params.getStringParameter( "int-2", null ) );
assertEquals( "param value is wrong", 100, params.getLongParameter( "int-2", -1 ) );
assertEquals( "param value is wrong", -1, params.getLongParameter( "int-3", -1 ) );
Object[] val = params.getArrayParameter( "int-2", null );
assertNotNull( "param value is wrong", val );
assertEquals( "param value is wrong", 100, val[0] );
assertEquals( "param value is wrong", 999, val[1] );
Object[][] value2 = new Object[0][0];
params.setParameter( "2darray", value2 );
assertEquals( "param value is wrong", value2, params.getParameter( "2darray" ) );
assertEquals( "param value is wrong", null, params.getStringParameter( "2darray", null ) );
}