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/07/27 11:53:21 UTC
svn commit: r1366318 - in /commons/sandbox/beanutils2/trunk/src: changes/
main/java/org/apache/commons/beanutils2/
test/java/org/apache/commons/beanutils2/
Author: simonetripodi
Date: Fri Jul 27 09:53:21 2012
New Revision: 1366318
URL: http://svn.apache.org/viewvc?rev=1366318&view=rev
Log:
[SANDBOX-430] Change getMapped(String).withKey(String) to getMapped(String).of(String) - patch submitted by Benedikt Ritter
Modified:
commons/sandbox/beanutils2/trunk/src/changes/changes.xml
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ArgumentsAccessor.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultArgumentsAccessor.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MappedPropertyGetterAccessor.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MappedPropertySetterAccessor.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/StaticMethodsTestCase.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/VoidMethodsTestCase.java
Modified: commons/sandbox/beanutils2/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/changes/changes.xml?rev=1366318&r1=1366317&r2=1366318&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/changes/changes.xml (original)
+++ commons/sandbox/beanutils2/trunk/src/changes/changes.xml Fri Jul 27 09:53:21 2012
@@ -23,6 +23,9 @@
</properties>
<body>
<release version="0.1" date="201?-??-??" description="First release.">
+ <action dev="simonetripodi" type="add" issue="SANDBOX-430" due-to="Benedikt Ritter">
+ Change getMapped(String).withKey(String) to getMapped(String).of(String)
+ </action>
<action dev="simonetripodi" type="add" issue="SANDBOX-429" due-to="Benedikt Ritter">
Implement unit tests for MethodsRegistry
</action>
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=1366318&r1=1366317&r2=1366318&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 Fri Jul 27 09:53:21 2012
@@ -40,6 +40,6 @@ public interface ArgumentsAccessor
* @throws InvocationTargetException TODO
* @throws NoSuchMethodException if no method with a fitting signature can be found.
*/
- BeanAccessor<?> withArguments( Argument<?>... arguments );
+ BeanAccessor<?> with( Argument<?>... arguments );
}
Modified: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultArgumentsAccessor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultArgumentsAccessor.java?rev=1366318&r1=1366317&r2=1366318&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultArgumentsAccessor.java (original)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultArgumentsAccessor.java Fri Jul 27 09:53:21 2012
@@ -50,7 +50,7 @@ final class DefaultArgumentsAccessor
this.bean = bean;
}
- public BeanAccessor<?> withArguments( Argument<?>... arguments )
+ public BeanAccessor<?> with( Argument<?>... arguments )
{
arguments = checkNotNull( arguments,
"Impossible to invoke %s.%s with null arguments, use empty parameters instead",
Modified: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MappedPropertyGetterAccessor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MappedPropertyGetterAccessor.java?rev=1366318&r1=1366317&r2=1366318&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MappedPropertyGetterAccessor.java (original)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MappedPropertyGetterAccessor.java Fri Jul 27 09:53:21 2012
@@ -22,6 +22,6 @@ package org.apache.commons.beanutils2;
public interface MappedPropertyGetterAccessor
{
- BeanAccessor<?> withKey( String key );
+ BeanAccessor<?> of( String key );
}
Modified: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MappedPropertySetterAccessor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MappedPropertySetterAccessor.java?rev=1366318&r1=1366317&r2=1366318&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MappedPropertySetterAccessor.java (original)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MappedPropertySetterAccessor.java Fri Jul 27 09:53:21 2012
@@ -22,6 +22,6 @@ package org.apache.commons.beanutils2;
public interface MappedPropertySetterAccessor<B>
{
- BeanPropertySetter<B> withKey( String key );
+ BeanPropertySetter<B> of( String key );
}
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=1366318&r1=1366317&r2=1366318&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 Fri Jul 27 09:53:21 2012
@@ -56,7 +56,7 @@ public class MethodsTestCase
public void invokeMethodGetBooleanProperty()
throws Exception
{
- Object value = on( testBean ).invoke( "getBooleanProperty" ).withArguments().get();
+ Object value = on( testBean ).invoke( "getBooleanProperty" ).with().get();
assertNotNull( value );
assertTrue( value instanceof Boolean );
assertEquals( testBean.getBooleanProperty(), ( (Boolean) value ).booleanValue() );
@@ -66,7 +66,7 @@ public class MethodsTestCase
public void invokeMethodSetBooleanProperty()
throws Exception
{
- on( testBean ).invoke( "setBooleanProperty" ).withArguments( argument( false ) );
+ on( testBean ).invoke( "setBooleanProperty" ).with( argument( false ) );
assertFalse( testBean.getBooleanProperty() );
}
@@ -74,7 +74,7 @@ public class MethodsTestCase
public void invokeMethodSetBooleanPropertyWithWrapper()
throws Exception
{
- on( testBean ).invoke( "setBooleanProperty" ).withArguments( argument( new Boolean( false ) ) );
+ on( testBean ).invoke( "setBooleanProperty" ).with( argument( new Boolean( false ) ) );
assertFalse( testBean.getBooleanProperty() );
}
@@ -82,7 +82,7 @@ public class MethodsTestCase
public void invokeMethodGetIntProperty()
throws Exception
{
- Object value = on( testBean ).invoke( "getIntProperty" ).withArguments().get();
+ Object value = on( testBean ).invoke( "getIntProperty" ).with().get();
assertNotNull( value );
assertTrue( value instanceof Integer );
assertEquals( testBean.getIntProperty(), ( (Integer) value ).intValue() );
@@ -92,7 +92,7 @@ public class MethodsTestCase
public void invokeMethodSetIntProperty()
throws Exception
{
- on( testBean ).invoke( "setIntProperty" ).withArguments( argument( 47 ) );
+ on( testBean ).invoke( "setIntProperty" ).with( argument( 47 ) );
assertEquals( testBean.getIntProperty(), 47 );
}
@@ -100,7 +100,7 @@ public class MethodsTestCase
public void invokeMethodSetIntPropertyWithWrapper()
throws Exception
{
- on( testBean ).invoke( "setIntProperty" ).withArguments( argument( new Integer( 47 ) ) );
+ on( testBean ).invoke( "setIntProperty" ).with( argument( new Integer( 47 ) ) );
assertEquals( testBean.getIntProperty(), 47 );
}
@@ -115,14 +115,14 @@ public class MethodsTestCase
public void invokeMethodNonExistent()
throws Exception
{
- on( testBean ).invoke( "nonExistent" ).withArguments();
+ on( testBean ).invoke( "nonExistent" ).with();
}
@Test
public void invokeExactGetBooleanProperty()
throws Exception
{
- Object value = on( testBean ).invokeExact( "getBooleanProperty" ).withArguments().get();
+ Object value = on( testBean ).invokeExact( "getBooleanProperty" ).with().get();
assertNotNull( value );
assertTrue( value instanceof Boolean );
assertTrue( testBean.getBooleanProperty() == (Boolean) value );
@@ -132,7 +132,7 @@ public class MethodsTestCase
public void invokeExactMethodSetBooleanProperty()
throws Exception
{
- on( testBean ).invokeExact( "setBooleanProperty" ).withArguments( argument( boolean.class, false ) );
+ on( testBean ).invokeExact( "setBooleanProperty" ).with( argument( boolean.class, false ) );
assertFalse( testBean.getBooleanProperty() );
}
@@ -140,14 +140,14 @@ public class MethodsTestCase
public void invokeExactMethodSetBooleanPropertyWithWrapper()
throws Exception
{
- on( testBean ).invokeExact( "setBooleanProperty" ).withArguments( argument( new Boolean( false ) ) );
+ on( testBean ).invokeExact( "setBooleanProperty" ).with( argument( new Boolean( false ) ) );
}
@Test
public void invokeExactMethodSetBooleanPropertyWithWrapperAsPrimitive()
throws Exception
{
- on( testBean ).invokeExact( "setBooleanProperty" ).withArguments( argument( boolean.class,
+ on( testBean ).invokeExact( "setBooleanProperty" ).with( argument( boolean.class,
new Boolean( false ) ) );
assertFalse( testBean.getBooleanProperty() );
}
@@ -156,7 +156,7 @@ public class MethodsTestCase
public void invokeExactGetIntProperty()
throws Exception
{
- Object value = on( testBean ).invokeExact( "getIntProperty" ).withArguments().get();
+ Object value = on( testBean ).invokeExact( "getIntProperty" ).with().get();
assertNotNull( value );
assertTrue( value instanceof Integer );
assertEquals( testBean.getIntProperty(), ( (Integer) value ).intValue() );
@@ -166,7 +166,7 @@ public class MethodsTestCase
public void invokeExactMethodSetIntProperty()
throws Exception
{
- on( testBean ).invokeExact( "setIntProperty" ).withArguments( argument( int.class, 47 ) );
+ on( testBean ).invokeExact( "setIntProperty" ).with( argument( int.class, 47 ) );
assertEquals( testBean.getIntProperty(), 47 );
}
@@ -174,14 +174,14 @@ public class MethodsTestCase
public void invokeExactMethodSetIntPropertyWithWrapper()
throws Exception
{
- on( testBean ).invokeExact( "setIntProperty" ).withArguments( argument( new Integer( 47 ) ) );
+ on( testBean ).invokeExact( "setIntProperty" ).with( argument( new Integer( 47 ) ) );
}
@Test
public void invokeExactMethodSetIntPropertyWithWrapperAsPrimitive()
throws Exception
{
- on( testBean ).invokeExact( "setIntProperty" ).withArguments( argument( int.class, new Integer( 47 ) ) );
+ on( testBean ).invokeExact( "setIntProperty" ).with( argument( int.class, new Integer( 47 ) ) );
assertEquals( testBean.getIntProperty(), 47 );
}
@@ -196,21 +196,21 @@ public class MethodsTestCase
public void invokeExactMethodNonExistent()
throws Exception
{
- on( testBean ).invokeExact( "nonExistent" ).withArguments();
+ on( testBean ).invokeExact( "nonExistent" ).with();
}
@Test(expected = MethodInvocationException.class)
public void invokeExceptionMethod()
throws Exception
{
- on( exceptionBean ).invoke( "setExceptionProperty" ).withArguments( argument( "Exception" ) );
+ on( exceptionBean ).invoke( "setExceptionProperty" ).with( argument( "Exception" ) );
}
@Test( expected = MethodInvocationException.class )
public void invokeExactExceptionMethod()
throws Exception
{
- on( exceptionBean ).invokeExact( "setExceptionProperty" ).withArguments( argument( "Exception" ) );
+ on( exceptionBean ).invokeExact( "setExceptionProperty" ).with( argument( "Exception" ) );
}
}
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=1366318&r1=1366317&r2=1366318&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 Fri Jul 27 09:53:21 2012
@@ -49,7 +49,7 @@ public final class StaticMethodsTestCase
public void invokeStaticMethodCurrentCounter()
throws Exception
{
- Object value = on( TestBean.class ).invokeStatic( "currentCounter" ).withArguments().get();
+ Object value = on( TestBean.class ).invokeStatic( "currentCounter" ).with().get();
assertEquals( "currentCounter value", oldValue, ( (Integer) value ).intValue() );
}
@@ -57,7 +57,7 @@ public final class StaticMethodsTestCase
public void invokeStaticMethodIncrementCounter()
throws Exception
{
- on( TestBean.class ).invokeStatic( "incrementCounter" ).withArguments();
+ on( TestBean.class ).invokeStatic( "incrementCounter" ).with();
assertEquals( oldValue + 1, TestBean.currentCounter() );
}
@@ -65,7 +65,7 @@ public final class StaticMethodsTestCase
public void invokeStaticMethodIncrementCounterIntegerPrimitive()
throws Exception
{
- on( TestBean.class ).invokeStatic( "incrementCounter" ).withArguments( argument( 8 ) ).get();
+ on( TestBean.class ).invokeStatic( "incrementCounter" ).with( argument( 8 ) ).get();
assertEquals( oldValue + 8, TestBean.currentCounter() );
}
@@ -73,7 +73,7 @@ public final class StaticMethodsTestCase
public void invokeStaticMethodIncrementCounterIntegerWrapper()
throws Exception
{
- on( TestBean.class ).invokeStatic( "incrementCounter" ).withArguments( argument( new Integer( 8 ) ) ).get();
+ on( TestBean.class ).invokeStatic( "incrementCounter" ).with( argument( new Integer( 8 ) ) ).get();
assertEquals( oldValue + 8, TestBean.currentCounter() );
}
@@ -81,7 +81,7 @@ public final class StaticMethodsTestCase
public void invokeStaticMethodIncrementCounterIntegerWrapperAsPrimitive()
throws Exception
{
- on( TestBean.class ).invokeStatic( "incrementCounter" ).withArguments( argument( int.class,
+ on( TestBean.class ).invokeStatic( "incrementCounter" ).with( argument( int.class,
new Integer( 8 ) ) ).get();
assertEquals( oldValue + 8, TestBean.currentCounter() );
}
@@ -90,7 +90,7 @@ public final class StaticMethodsTestCase
public void invokeStaticMethodIncrementCounterNumberInteger()
throws Exception
{
- on( TestBean.class ).invokeStatic( "incrementCounter" ).withArguments( argument( Number.class,
+ on( TestBean.class ).invokeStatic( "incrementCounter" ).with( argument( Number.class,
new Integer( 8 ) ) ).get();
// incrementCounter(Number) will multiply its input with 2
assertEquals( oldValue + 8 * 2, TestBean.currentCounter() );
@@ -101,13 +101,13 @@ public final class StaticMethodsTestCase
throws Exception
{
String methodName = "incrementCounter";
- on( TestBean.class ).invokeStatic( methodName ).withArguments( argument( 'x' ) );
+ on( TestBean.class ).invokeStatic( methodName ).with( argument( 'x' ) );
}
@Test
public void invokeExactStaticMethodIncrementCounter() throws Exception
{
- on( TestBean.class ).invokeExactStatic( "incrementCounter" ).withArguments();
+ on( TestBean.class ).invokeExactStatic( "incrementCounter" ).with();
assertEquals( oldValue + 1, TestBean.currentCounter() );
}
@@ -115,7 +115,7 @@ public final class StaticMethodsTestCase
public void invokeExactStaticMethodIncrementIntegerPrimitive()
throws Exception
{
- on( TestBean.class ).invokeExactStatic( "incrementCounter" ).withArguments( argument( int.class, 8 ) ).get();
+ on( TestBean.class ).invokeExactStatic( "incrementCounter" ).with( argument( int.class, 8 ) ).get();
assertEquals( oldValue + 8, TestBean.currentCounter() );
}
@@ -123,14 +123,14 @@ public final class StaticMethodsTestCase
public void invokeExactStaticMethodIncrementIntegerWrapper()
throws Exception
{
- on( TestBean.class ).invokeExactStatic( "incrementCounter" ).withArguments( argument( new Integer( 8 ) ) ).get();
+ on( TestBean.class ).invokeExactStatic( "incrementCounter" ).with( argument( new Integer( 8 ) ) ).get();
}
@Test
public void invokeExactStaticMethodIncrementNumberInteger()
throws Exception
{
- on( TestBean.class ).invokeExactStatic( "incrementCounter" ).withArguments( argument( Number.class,
+ on( TestBean.class ).invokeExactStatic( "incrementCounter" ).with( argument( Number.class,
new Integer( 8 ) ) ).get();
// incrementCounter(Number) will multiply its input with 2
assertEquals( oldValue + 2 * 8, TestBean.currentCounter() );
@@ -140,14 +140,14 @@ public final class StaticMethodsTestCase
public void invokeStaticExceptionMethod()
throws Exception
{
- on( ThrowingExceptionBean.class ).invokeStatic( "staticException" ).withArguments( argument( "Exception" ) );
+ on( ThrowingExceptionBean.class ).invokeStatic( "staticException" ).with( argument( "Exception" ) );
}
@Test( expected = MethodInvocationException.class )
public void invokeExactStaticExceptionMethod()
throws Exception
{
- on( ThrowingExceptionBean.class ).invokeExactStatic( "staticException" ).withArguments( argument( "Exception" ) );
+ on( ThrowingExceptionBean.class ).invokeExactStatic( "staticException" ).with( argument( "Exception" ) );
}
}
Modified: commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/VoidMethodsTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/VoidMethodsTestCase.java?rev=1366318&r1=1366317&r2=1366318&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/VoidMethodsTestCase.java (original)
+++ commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/VoidMethodsTestCase.java Fri Jul 27 09:53:21 2012
@@ -39,7 +39,7 @@ public class VoidMethodsTestCase
public void setUp()
throws Exception
{
- voidAccessor = on( TestBean.class ).invokeStatic( "incrementCounter" ).withArguments();
+ voidAccessor = on( TestBean.class ).invokeStatic( "incrementCounter" ).with();
assertTrue( voidAccessor instanceof NullBeanAccessor );
}