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/01/22 22:52:21 UTC
svn commit: r1234625 - in /commons/sandbox/beanutils2/trunk/src:
main/java/org/apache/commons/beanutils2/DefaultArgumentsAccessor.java
test/java/org/apache/commons/beanutils2/StaticMethodsTestCase.java
Author: simonetripodi
Date: Sun Jan 22 21:52:21 2012
New Revision: 1234625
URL: http://svn.apache.org/viewvc?rev=1234625&view=rev
Log:
completed static methods invocations
Added:
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/StaticMethodsTestCase.java (with props)
Modified:
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultArgumentsAccessor.java
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=1234625&r1=1234624&r2=1234625&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 Sun Jan 22 21:52:21 2012
@@ -58,7 +58,7 @@ final class DefaultArgumentsAccessor
methodName );
arguments = checkNoneIsNull( arguments );
- Method method = methodsRegistry.get( isExact, beanType, getParameterTypes( arguments ) );
+ Method method = methodsRegistry.get( isExact, beanType, methodName, getParameterTypes( arguments ) );
if ( method == null )
{
Added: 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=1234625&view=auto
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/StaticMethodsTestCase.java (added)
+++ commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/StaticMethodsTestCase.java Sun Jan 22 21:52:21 2012
@@ -0,0 +1,59 @@
+package org.apache.commons.beanutils2;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import static org.apache.commons.beanutils2.Argument.argument;
+import static org.apache.commons.beanutils2.BeanUtils.on;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public final class StaticMethodsTestCase
+{
+
+ @Test
+ public void invokeStaticMethod()
+ throws Exception
+ {
+
+ Object value = null;
+ int current = TestBean.currentCounter();
+
+ value = on( TestBean.class ).invokeStaticMethod( "currentCounter" ).withArguments().get();
+ assertEquals( "currentCounter value", current, ( (Integer) value ).intValue() );
+
+ on( TestBean.class ).invokeStaticMethod( "incrementCounter" ).withArguments();
+ current++;
+
+ value = on( TestBean.class ).invokeStaticMethod( "currentCounter" ).withArguments().get();
+ assertEquals( "currentCounter value", current, ( (Integer) value ).intValue() );
+
+ on( TestBean.class ).invokeStaticMethod( "incrementCounter" ).withArguments( argument( new Integer( 8 ) ) ).get();
+ current += 8;
+
+ value = on( TestBean.class ).invokeStaticMethod( "currentCounter" ).withArguments().get();
+ assertEquals( "currentCounter value", current, ( (Integer) value ).intValue() );
+
+ on( TestBean.class ).invokeStaticMethod( "incrementCounter" ).withArguments( argument( Number.class, new Integer( 8 ) ) ).get();
+ current += 16;
+
+ value = on( TestBean.class ).invokeStaticMethod( "currentCounter" ).withArguments().get();
+ assertEquals( "currentCounter value", current, ( (Integer) value ).intValue() );
+ }
+
+}
Propchange: commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/StaticMethodsTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/StaticMethodsTestCase.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/StaticMethodsTestCase.java
------------------------------------------------------------------------------
svn:mime-type = text/plain