You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2012/02/05 22:52:51 UTC
svn commit: r1240837 - in /commons/sandbox/beanutils2/trunk/src:
main/java/org/apache/commons/beanutils2/
test/java/org/apache/commons/beanutils2/
Author: simonetripodi
Date: Sun Feb 5 21:52:50 2012
New Revision: 1240837
URL: http://svn.apache.org/viewvc?rev=1240837&view=rev
Log:
experimenting compressed and less verbose APIs
Modified:
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ArgumentsAccessor.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanAccessor.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanPropertySetter.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ClassAccessor.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultBeanAccessor.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultBeanPropertySetter.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultClassAccessor.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/GetPropertyTestCase.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/MethodsTestCase.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/SetPropertyTestCase.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/StaticMethodsTestCase.java
Modified: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ArgumentsAccessor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ArgumentsAccessor.java?rev=1240837&r1=1240836&r2=1240837&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ArgumentsAccessor.java (original)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ArgumentsAccessor.java Sun Feb 5 21:52:50 2012
@@ -31,7 +31,7 @@ public interface ArgumentsAccessor
* Passes the given arguments to the called constructor or method. Note that if you wont to pass primitive
* arguments, you have to call {@link Argument#argument(Class, Object)} and pass the primitive class. This
* especially applies if you called {@link ClassAccessor#invokeExactConstructor(Argument...)},
- * {@link ClassAccessor#invokeExactStaticMethod(String)} or {@link BeanAccessor#invokeExactMethod(String)} before.
+ * {@link ClassAccessor#invokeExactStatic(String)} or {@link BeanAccessor#invokeExact(String)} before.
*
* @param arguments the arguments to be passed. May be empty.
* @return a {@link BeanAccessor} for the result of the method invocation.
Modified: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanAccessor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanAccessor.java?rev=1240837&r1=1240836&r2=1240837&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanAccessor.java (original)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanAccessor.java Sun Feb 5 21:52:50 2012
@@ -28,13 +28,13 @@ public interface BeanAccessor<B>
// get
- BeanAccessor<?> getProperty( String name )
+ BeanAccessor<?> get( String propertyName )
throws IllegalAccessException, IntrospectionException, InvocationTargetException, NoSuchMethodException;
- IndexedPropertyGetterAccessor getIndexedProperty( String name )
+ IndexedPropertyGetterAccessor getIndexed( String propertyName )
throws IllegalAccessException, InvocationTargetException, NoSuchMethodException;
- MappedPropertyGetterAccessor getMappedProperty( String name )
+ MappedPropertyGetterAccessor getMapped( String propertyName )
throws IllegalAccessException, InvocationTargetException, NoSuchMethodException;
B get();
@@ -43,13 +43,13 @@ public interface BeanAccessor<B>
// set
- BeanPropertySetter<B> setProperty( String name )
+ BeanPropertySetter<B> set( String propertyName )
throws IllegalAccessException, IntrospectionException, InvocationTargetException, NoSuchMethodException;
- IndexedPropertySetterAccessor<B> setIndexedProperty( String name )
+ IndexedPropertySetterAccessor<B> setIndexed( String propertyName )
throws IllegalAccessException, IntrospectionException, InvocationTargetException, NoSuchMethodException;
- IndexedPropertySetterAccessor<B> setMappedProperty( String name )
+ IndexedPropertySetterAccessor<B> setMapped( String propertyName )
throws IllegalAccessException, IntrospectionException, InvocationTargetException, NoSuchMethodException;
// clone
@@ -117,7 +117,7 @@ public interface BeanAccessor<B>
* @throws IllegalAccessException if the method is not visible to the caller
* @throws InvocationTargetException TODO
*/
- ArgumentsAccessor invokeMethod( String methodName )
+ ArgumentsAccessor invoke( String methodName )
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException;
/**
@@ -130,7 +130,7 @@ public interface BeanAccessor<B>
* @throws IllegalAccessException if the method is not visible to the caller
* @throws InvocationTargetException TODO
*/
- ArgumentsAccessor invokeExactMethod( String methodName )
+ ArgumentsAccessor invokeExact( String methodName )
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException;
}
Modified: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanPropertySetter.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanPropertySetter.java?rev=1240837&r1=1240836&r2=1240837&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanPropertySetter.java (original)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanPropertySetter.java Sun Feb 5 21:52:50 2012
@@ -24,7 +24,7 @@ import java.lang.reflect.InvocationTarge
public interface BeanPropertySetter<B>
{
- <V> BeanAccessor<B> withValue( V value )
+ <V> BeanAccessor<B> with( V value )
throws IllegalAccessException, IllegalArgumentException, InvocationTargetException;
}
Modified: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ClassAccessor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ClassAccessor.java?rev=1240837&r1=1240836&r2=1240837&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ClassAccessor.java (original)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ClassAccessor.java Sun Feb 5 21:52:50 2012
@@ -39,8 +39,8 @@ public interface ClassAccessor<B>
// static methods invocation
- ArgumentsAccessor invokeStaticMethod( String methodName );
+ ArgumentsAccessor invokeStatic( String methodName );
- ArgumentsAccessor invokeExactStaticMethod( String methodName );
+ ArgumentsAccessor invokeExactStatic( String methodName );
}
Modified: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultBeanAccessor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultBeanAccessor.java?rev=1240837&r1=1240836&r2=1240837&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultBeanAccessor.java (original)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultBeanAccessor.java Sun Feb 5 21:52:50 2012
@@ -46,7 +46,7 @@ final class DefaultBeanAccessor<B>
/**
* {@inheritDoc}
*/
- public BeanAccessor<?> getProperty( String name )
+ public BeanAccessor<?> get( String name )
throws IllegalAccessException, IntrospectionException, InvocationTargetException, NoSuchMethodException
{
PropertyDescriptor propertyDescriptor = registry.getPropertyDescriptor( bean.getClass(), name );
@@ -66,7 +66,7 @@ final class DefaultBeanAccessor<B>
/**
* {@inheritDoc}
*/
- public IndexedPropertyGetterAccessor getIndexedProperty( String name )
+ public IndexedPropertyGetterAccessor getIndexed( String propertyName )
throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
{
// TODO
@@ -76,7 +76,7 @@ final class DefaultBeanAccessor<B>
/**
* {@inheritDoc}
*/
- public MappedPropertyGetterAccessor getMappedProperty( String name )
+ public MappedPropertyGetterAccessor getMapped( String propertyName )
throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
{
// TODO
@@ -106,17 +106,17 @@ final class DefaultBeanAccessor<B>
/**
* {@inheritDoc}
*/
- public BeanPropertySetter<B> setProperty( String name )
+ public BeanPropertySetter<B> set( String propertyName )
throws IllegalAccessException, IntrospectionException, InvocationTargetException, NoSuchMethodException
{
- PropertyDescriptor propertyDescriptor = registry.getPropertyDescriptor( bean.getClass(), name );
+ PropertyDescriptor propertyDescriptor = registry.getPropertyDescriptor( bean.getClass(), propertyName );
propertyDescriptor = checkNotNull( propertyDescriptor, "Property '%s' does not exist in bean of type %s",
- name, bean.getClass().getName() );
+ propertyName, bean.getClass().getName() );
if ( propertyDescriptor.getWriteMethod() == null )
{
throw new NoSuchMethodException( String.format( "Bean of type %s does not provide a setter for property '%s'!",
- bean.getClass().getName(), name ) );
+ bean.getClass().getName(), propertyName ) );
}
return new DefaultBeanPropertySetter<B>( bean, propertyDescriptor.getWriteMethod() );
}
@@ -124,7 +124,7 @@ final class DefaultBeanAccessor<B>
/**
* {@inheritDoc}
*/
- public IndexedPropertySetterAccessor<B> setIndexedProperty( String name )
+ public IndexedPropertySetterAccessor<B> setIndexed( String propertyName )
throws IllegalAccessException, IntrospectionException, InvocationTargetException, NoSuchMethodException
{
// TODO
@@ -134,7 +134,7 @@ final class DefaultBeanAccessor<B>
/**
* {@inheritDoc}
*/
- public IndexedPropertySetterAccessor<B> setMappedProperty( String name )
+ public IndexedPropertySetterAccessor<B> setMapped( String propertyName )
throws IllegalAccessException, IntrospectionException, InvocationTargetException, NoSuchMethodException
{
// TODO
@@ -192,7 +192,7 @@ final class DefaultBeanAccessor<B>
/**
* {@inheritDoc}
*/
- public ArgumentsAccessor invokeMethod( String methodName )
+ public ArgumentsAccessor invoke( String methodName )
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
{
@SuppressWarnings( "unchecked" )
@@ -204,7 +204,7 @@ final class DefaultBeanAccessor<B>
/**
* {@inheritDoc}
*/
- public ArgumentsAccessor invokeExactMethod( String methodName )
+ public ArgumentsAccessor invokeExact( String methodName )
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
{
@SuppressWarnings( "unchecked" )
Modified: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultBeanPropertySetter.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultBeanPropertySetter.java?rev=1240837&r1=1240836&r2=1240837&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultBeanPropertySetter.java (original)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultBeanPropertySetter.java Sun Feb 5 21:52:50 2012
@@ -42,7 +42,7 @@ final class DefaultBeanPropertySetter<B>
/**
* {@inheritDoc}
*/
- public <V> BeanAccessor<B> withValue( V value )
+ public <V> BeanAccessor<B> with( V value )
throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
{
Class<?> paramType = setterMethod.getParameterTypes()[0];
Modified: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultClassAccessor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultClassAccessor.java?rev=1240837&r1=1240836&r2=1240837&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultClassAccessor.java (original)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultClassAccessor.java Sun Feb 5 21:52:50 2012
@@ -121,7 +121,7 @@ final class DefaultClassAccessor<B>
/**
* {@inheritDoc}
*/
- public ArgumentsAccessor invokeStaticMethod( String methodName )
+ public ArgumentsAccessor invokeStatic( String methodName )
{
methodName = checkNotNull( methodName, "Impossible to execute null static method in %s", beanClass.getName() );
return new DefaultArgumentsAccessor( beanClass, false, methodName, null );
@@ -130,7 +130,7 @@ final class DefaultClassAccessor<B>
/**
* {@inheritDoc}
*/
- public ArgumentsAccessor invokeExactStaticMethod( String methodName )
+ public ArgumentsAccessor invokeExactStatic( String methodName )
{
methodName = checkNotNull( methodName, "Impossible to execute null static method in %s", beanClass.getName() );
return new DefaultArgumentsAccessor( beanClass, true, methodName, null );
Modified: commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/GetPropertyTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/GetPropertyTestCase.java?rev=1240837&r1=1240836&r2=1240837&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/GetPropertyTestCase.java (original)
+++ commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/GetPropertyTestCase.java Sun Feb 5 21:52:50 2012
@@ -51,7 +51,7 @@ public final class GetPropertyTestCase
public void getSimpleBoolean()
throws Exception
{
- Object value = on( bean ).getProperty( "booleanProperty" ).get();
+ Object value = on( bean ).get( "booleanProperty" ).get();
assertNotNull( "Got no value", value );
assertTrue( "Got a value of the wrong type", ( value instanceof Boolean ) );
assertTrue( "Got an incorrect value", ( (Boolean) value ).booleanValue() == bean.getBooleanProperty() );
@@ -61,7 +61,7 @@ public final class GetPropertyTestCase
public void getWirteOnlyProperty()
throws Exception
{
- on( bean ).getProperty( "writeOnlyProperty" ).get();
+ on( bean ).get( "writeOnlyProperty" ).get();
}
}
Modified: commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/MethodsTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/MethodsTestCase.java?rev=1240837&r1=1240836&r2=1240837&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/MethodsTestCase.java (original)
+++ commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/MethodsTestCase.java Sun Feb 5 21:52:50 2012
@@ -52,7 +52,7 @@ public class MethodsTestCase
public void invokeMethodGetBooleanProperty()
throws Exception
{
- Object value = on( testBean ).invokeMethod( "getBooleanProperty" ).withArguments().get();
+ Object value = on( testBean ).invoke( "getBooleanProperty" ).withArguments().get();
assertNotNull( value );
assertTrue( value instanceof Boolean );
assertEquals( testBean.getBooleanProperty(), ( (Boolean) value ).booleanValue() );
@@ -62,7 +62,7 @@ public class MethodsTestCase
public void invokeMethodSetBooleanProperty()
throws Exception
{
- on( testBean ).invokeMethod( "setBooleanProperty" ).withArguments( argument( false ) );
+ on( testBean ).invoke( "setBooleanProperty" ).withArguments( argument( false ) );
assertFalse( testBean.getBooleanProperty() );
}
@@ -70,7 +70,7 @@ public class MethodsTestCase
public void invokeMethodSetBooleanPropertyWithWrapper()
throws Exception
{
- on( testBean ).invokeMethod( "setBooleanProperty" ).withArguments( argument( new Boolean( false ) ) );
+ on( testBean ).invoke( "setBooleanProperty" ).withArguments( argument( new Boolean( false ) ) );
assertFalse( testBean.getBooleanProperty() );
}
@@ -78,7 +78,7 @@ public class MethodsTestCase
public void invokeMethodGetIntProperty()
throws Exception
{
- Object value = on( testBean ).invokeMethod( "getIntProperty" ).withArguments().get();
+ Object value = on( testBean ).invoke( "getIntProperty" ).withArguments().get();
assertNotNull( value );
assertTrue( value instanceof Integer );
assertEquals( testBean.getIntProperty(), ( (Integer) value ).intValue() );
@@ -88,7 +88,7 @@ public class MethodsTestCase
public void invokeMethodSetIntProperty()
throws Exception
{
- on( testBean ).invokeMethod( "setIntProperty" ).withArguments( argument( 47 ) );
+ on( testBean ).invoke( "setIntProperty" ).withArguments( argument( 47 ) );
assertEquals( testBean.getIntProperty(), 47 );
}
@@ -96,7 +96,7 @@ public class MethodsTestCase
public void invokeMethodSetIntPropertyWithWrapper()
throws Exception
{
- on( testBean ).invokeMethod( "setIntProperty" ).withArguments( argument( new Integer( 47 ) ) );
+ on( testBean ).invoke( "setIntProperty" ).withArguments( argument( new Integer( 47 ) ) );
assertEquals( testBean.getIntProperty(), 47 );
}
@@ -104,21 +104,21 @@ public class MethodsTestCase
public void invokeMethodNull()
throws Exception
{
- on( testBean ).invokeMethod( null );
+ on( testBean ).invoke( null );
}
@Test( expected = NoSuchMethodException.class )
public void invokeMethodNonExistent()
throws Exception
{
- on( testBean ).invokeMethod( "nonExistent" ).withArguments();
+ on( testBean ).invoke( "nonExistent" ).withArguments();
}
@Test
public void invokeExactGetBooleanProperty()
throws Exception
{
- Object value = on( testBean ).invokeExactMethod( "getBooleanProperty" ).withArguments().get();
+ Object value = on( testBean ).invokeExact( "getBooleanProperty" ).withArguments().get();
assertNotNull( value );
assertTrue( value instanceof Boolean );
assertTrue( testBean.getBooleanProperty() == (Boolean) value );
@@ -128,7 +128,7 @@ public class MethodsTestCase
public void invokeExactMethodSetBooleanProperty()
throws Exception
{
- on( testBean ).invokeExactMethod( "setBooleanProperty" ).withArguments( argument( boolean.class, false ) );
+ on( testBean ).invokeExact( "setBooleanProperty" ).withArguments( argument( boolean.class, false ) );
assertFalse( testBean.getBooleanProperty() );
}
@@ -136,14 +136,14 @@ public class MethodsTestCase
public void invokeExactMethodSetBooleanPropertyWithWrapper()
throws Exception
{
- on( testBean ).invokeExactMethod( "setBooleanProperty" ).withArguments( argument( new Boolean( false ) ) );
+ on( testBean ).invokeExact( "setBooleanProperty" ).withArguments( argument( new Boolean( false ) ) );
}
@Test
public void invokeExactMethodSetBooleanPropertyWithWrapperAsPrimitive()
throws Exception
{
- on( testBean ).invokeExactMethod( "setBooleanProperty" ).withArguments( argument( boolean.class,
+ on( testBean ).invokeExact( "setBooleanProperty" ).withArguments( argument( boolean.class,
new Boolean( false ) ) );
assertFalse( testBean.getBooleanProperty() );
}
@@ -152,7 +152,7 @@ public class MethodsTestCase
public void invokeExactGetIntProperty()
throws Exception
{
- Object value = on( testBean ).invokeExactMethod( "getIntProperty" ).withArguments().get();
+ Object value = on( testBean ).invokeExact( "getIntProperty" ).withArguments().get();
assertNotNull( value );
assertTrue( value instanceof Integer );
assertEquals( testBean.getIntProperty(), ( (Integer) value ).intValue() );
@@ -162,7 +162,7 @@ public class MethodsTestCase
public void invokeExactMethodSetIntProperty()
throws Exception
{
- on( testBean ).invokeExactMethod( "setIntProperty" ).withArguments( argument( int.class, 47 ) );
+ on( testBean ).invokeExact( "setIntProperty" ).withArguments( argument( int.class, 47 ) );
assertEquals( testBean.getIntProperty(), 47 );
}
@@ -170,14 +170,14 @@ public class MethodsTestCase
public void invokeExactMethodSetIntPropertyWithWrapper()
throws Exception
{
- on( testBean ).invokeExactMethod( "setIntProperty" ).withArguments( argument( new Integer( 47 ) ) );
+ on( testBean ).invokeExact( "setIntProperty" ).withArguments( argument( new Integer( 47 ) ) );
}
@Test
public void invokeExactMethodSetIntPropertyWithWrapperAsPrimitive()
throws Exception
{
- on( testBean ).invokeExactMethod( "setIntProperty" ).withArguments( argument( int.class, new Integer( 47 ) ) );
+ on( testBean ).invokeExact( "setIntProperty" ).withArguments( argument( int.class, new Integer( 47 ) ) );
assertEquals( testBean.getIntProperty(), 47 );
}
@@ -185,14 +185,14 @@ public class MethodsTestCase
public void invokeExactMethodNull()
throws Exception
{
- on( testBean ).invokeExactMethod( null );
+ on( testBean ).invokeExact( null );
}
@Test( expected = NoSuchMethodException.class )
public void invokeExactMethodNonExistent()
throws Exception
{
- on( testBean ).invokeExactMethod( "nonExistent" ).withArguments();
+ on( testBean ).invokeExact( "nonExistent" ).withArguments();
}
}
Modified: commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/SetPropertyTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/SetPropertyTestCase.java?rev=1240837&r1=1240836&r2=1240837&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/SetPropertyTestCase.java (original)
+++ commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/SetPropertyTestCase.java Sun Feb 5 21:52:50 2012
@@ -49,7 +49,7 @@ public class SetPropertyTestCase
public void setSimpleBoolean()
throws Exception
{
- on( testBean ).setProperty( "booleanProperty" ).withValue( false );
+ on( testBean ).set( "booleanProperty" ).with( false );
assertFalse( testBean.getBooleanProperty() );
}
@@ -58,7 +58,7 @@ public class SetPropertyTestCase
throws Exception
{
byte byteValue = (byte) 36;
- on( testBean ).setProperty( "byteProperty" ).withValue( byteValue );
+ on( testBean ).set( "byteProperty" ).with( byteValue );
assertEquals( byteValue, testBean.getByteProperty() );
}
@@ -70,7 +70,7 @@ public class SetPropertyTestCase
@Test
public void setPropertyToNull() throws Exception
{
- on(testBean).setProperty( "stringProperty" ).withValue( null );
+ on(testBean).set( "stringProperty" ).with( null );
assertNull( testBean.getStringProperty() );
}
@@ -81,7 +81,7 @@ public class SetPropertyTestCase
public void setNonExistentProperty()
throws Exception
{
- on( testBean ).setProperty( "nonExistent" ).withValue( null );
+ on( testBean ).set( "nonExistent" ).with( null );
}
/**
@@ -91,7 +91,7 @@ public class SetPropertyTestCase
public void setPropertyWithInCompatibleValue()
throws Exception
{
- on( testBean ).setProperty( "booleanProperty" ).withValue( 'x' );
+ on( testBean ).set( "booleanProperty" ).with( 'x' );
}
/**
@@ -101,7 +101,7 @@ public class SetPropertyTestCase
public void setNullToPrimitiveProperty()
throws Exception
{
- on( testBean ).setProperty( "booleanProperty" ).withValue( null );
+ on( testBean ).set( "booleanProperty" ).with( null );
}
/**
@@ -111,7 +111,7 @@ public class SetPropertyTestCase
public void setReadOnlyProperty()
throws Exception
{
- on( testBean ).setProperty( "readOnlyProperty" ).withValue( 15 );
+ on( testBean ).set( "readOnlyProperty" ).with( 15 );
}
}
Modified: commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/StaticMethodsTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/StaticMethodsTestCase.java?rev=1240837&r1=1240836&r2=1240837&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/StaticMethodsTestCase.java (original)
+++ commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/StaticMethodsTestCase.java Sun Feb 5 21:52:50 2012
@@ -52,7 +52,7 @@ public final class StaticMethodsTestCase
public void invokeStaticMethodCurrentCounter()
throws Exception
{
- Object value = on( TestBean.class ).invokeStaticMethod( "currentCounter" ).withArguments().get();
+ Object value = on( TestBean.class ).invokeStatic( "currentCounter" ).withArguments().get();
assertEquals( "currentCounter value", oldValue, ( (Integer) value ).intValue() );
}
@@ -60,7 +60,7 @@ public final class StaticMethodsTestCase
public void invokeStaticMethodIncrementCounter()
throws Exception
{
- on( TestBean.class ).invokeStaticMethod( "incrementCounter" ).withArguments();
+ on( TestBean.class ).invokeStatic( "incrementCounter" ).withArguments();
assertEquals( oldValue + 1, TestBean.currentCounter() );
}
@@ -68,7 +68,7 @@ public final class StaticMethodsTestCase
public void invokeStaticMethodIncrementCounterIntegerPrimitive()
throws Exception
{
- on( TestBean.class ).invokeStaticMethod( "incrementCounter" ).withArguments( argument( 8 ) ).get();
+ on( TestBean.class ).invokeStatic( "incrementCounter" ).withArguments( argument( 8 ) ).get();
assertEquals( oldValue + 8, TestBean.currentCounter() );
}
@@ -76,7 +76,7 @@ public final class StaticMethodsTestCase
public void invokeStaticMethodIncrementCounterIntegerWrapper()
throws Exception
{
- on( TestBean.class ).invokeStaticMethod( "incrementCounter" ).withArguments( argument( new Integer( 8 ) ) ).get();
+ on( TestBean.class ).invokeStatic( "incrementCounter" ).withArguments( argument( new Integer( 8 ) ) ).get();
assertEquals( oldValue + 8, TestBean.currentCounter() );
}
@@ -84,7 +84,7 @@ public final class StaticMethodsTestCase
public void invokeStaticMethodIncrementCounterIntegerWrapperAsPrimitive()
throws Exception
{
- on( TestBean.class ).invokeStaticMethod( "incrementCounter" ).withArguments( argument( int.class,
+ on( TestBean.class ).invokeStatic( "incrementCounter" ).withArguments( argument( int.class,
new Integer( 8 ) ) ).get();
assertEquals( oldValue + 8, TestBean.currentCounter() );
}
@@ -93,7 +93,7 @@ public final class StaticMethodsTestCase
public void invokeStaticMethodIncrementCounterNumberInteger()
throws Exception
{
- on( TestBean.class ).invokeStaticMethod( "incrementCounter" ).withArguments( argument( Number.class,
+ on( TestBean.class ).invokeStatic( "incrementCounter" ).withArguments( argument( Number.class,
new Integer( 8 ) ) ).get();
// incrementCounter(Number) will multiply its input with 2
assertEquals( oldValue + 8 * 2, TestBean.currentCounter() );
@@ -108,13 +108,13 @@ public final class StaticMethodsTestCase
thrown.expectMessage( "No such accessible method:" );
thrown.expectMessage( methodName );
thrown.expectMessage( TestBean.class.getName() );
- on( TestBean.class ).invokeStaticMethod( methodName ).withArguments( argument( 'x' ) );
+ on( TestBean.class ).invokeStatic( methodName ).withArguments( argument( 'x' ) );
}
@Test
public void invokeExactStaticMethodIncrementCounter() throws Exception
{
- on( TestBean.class ).invokeExactStaticMethod( "incrementCounter" ).withArguments();
+ on( TestBean.class ).invokeExactStatic( "incrementCounter" ).withArguments();
assertEquals( oldValue + 1, TestBean.currentCounter() );
}
@@ -122,7 +122,7 @@ public final class StaticMethodsTestCase
public void invokeExactStaticMethodIncrementIntegerPrimitive()
throws Exception
{
- on( TestBean.class ).invokeExactStaticMethod( "incrementCounter" ).withArguments( argument( int.class, 8 ) ).get();
+ on( TestBean.class ).invokeExactStatic( "incrementCounter" ).withArguments( argument( int.class, 8 ) ).get();
assertEquals( oldValue + 8, TestBean.currentCounter() );
}
@@ -130,14 +130,14 @@ public final class StaticMethodsTestCase
public void invokeExactStaticMethodIncrementIntegerWrapper()
throws Exception
{
- on( TestBean.class ).invokeExactStaticMethod( "incrementCounter" ).withArguments( argument( new Integer( 8 ) ) ).get();
+ on( TestBean.class ).invokeExactStatic( "incrementCounter" ).withArguments( argument( new Integer( 8 ) ) ).get();
}
@Test
public void invokeExactStaticMethodIncrementNumberInteger()
throws Exception
{
- on( TestBean.class ).invokeExactStaticMethod( "incrementCounter" ).withArguments( argument( Number.class,
+ on( TestBean.class ).invokeExactStatic( "incrementCounter" ).withArguments( argument( Number.class,
new Integer( 8 ) ) ).get();
// incrementCounter(Number) will multiply its input with 2
assertEquals( oldValue + 2 * 8, TestBean.currentCounter() );