You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by br...@apache.org on 2014/05/03 15:14:55 UTC
svn commit: r1592200 [7/9] - in /commons/sandbox/beanutils2/trunk: config/
src/changes/ src/main/java/org/apache/commons/beanutils2/
src/main/java/org/apache/commons/beanutils2/transformers/
src/test/java/org/apache/commons/beanutils2/ src/test/java/or...
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=1592200&r1=1592199&r2=1592200&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 Sat May 3 13:14:53 2014
@@ -1,5 +1,3 @@
-package org.apache.commons.beanutils2;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,6 +17,8 @@ package org.apache.commons.beanutils2;
* under the License.
*/
+package org.apache.commons.beanutils2;
+
import static org.apache.commons.beanutils2.Argument.argument;
import static org.apache.commons.beanutils2.BeanUtils.on;
import static org.junit.Assert.assertEquals;
@@ -29,126 +29,110 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-public final class StaticMethodsTestCase
-{
+public final class StaticMethodsTestCase {
private int oldValue;
@Before
- public void setUp()
- {
+ public void setUp() {
oldValue = TestBean.currentCounter();
}
@After
- public void tearDown()
- {
+ public void tearDown() {
oldValue = 0;
}
@Test
public void invokeStaticMethodCurrentCounter()
- throws Exception
- {
- Object value = on( TestBean.class ).invokeStatic( "currentCounter" ).with().get();
- assertEquals( "currentCounter value", oldValue, ( (Integer) value ).intValue() );
+ throws Exception {
+ Object value = on(TestBean.class).invokeStatic("currentCounter").with().get();
+ assertEquals("currentCounter value", oldValue, ((Integer) value).intValue());
}
@Test
public void invokeStaticMethodIncrementCounter()
- throws Exception
- {
- on( TestBean.class ).invokeStatic( "incrementCounter" ).with();
- assertEquals( oldValue + 1, TestBean.currentCounter() );
+ throws Exception {
+ on(TestBean.class).invokeStatic("incrementCounter").with();
+ assertEquals(oldValue + 1, TestBean.currentCounter());
}
@Test
public void invokeStaticMethodIncrementCounterIntegerPrimitive()
- throws Exception
- {
- on( TestBean.class ).invokeStatic( "incrementCounter" ).with( argument( 8 ) ).get();
- assertEquals( oldValue + 8, TestBean.currentCounter() );
+ throws Exception {
+ on(TestBean.class).invokeStatic("incrementCounter").with(argument(8)).get();
+ assertEquals(oldValue + 8, TestBean.currentCounter());
}
@Test
public void invokeStaticMethodIncrementCounterIntegerWrapper()
- throws Exception
- {
- on( TestBean.class ).invokeStatic( "incrementCounter" ).with( argument( new Integer( 8 ) ) ).get();
- assertEquals( oldValue + 8, TestBean.currentCounter() );
+ throws Exception {
+ on(TestBean.class).invokeStatic("incrementCounter").with(argument(new Integer(8))).get();
+ assertEquals(oldValue + 8, TestBean.currentCounter());
}
@Test
public void invokeStaticMethodIncrementCounterIntegerWrapperAsPrimitive()
- throws Exception
- {
- on( TestBean.class ).invokeStatic( "incrementCounter" ).with( argument( int.class,
- new Integer( 8 ) ) ).get();
- assertEquals( oldValue + 8, TestBean.currentCounter() );
+ throws Exception {
+ on(TestBean.class).invokeStatic("incrementCounter").with(argument(int.class,
+ new Integer(8))).get();
+ assertEquals(oldValue + 8, TestBean.currentCounter());
}
@Test
public void invokeStaticMethodIncrementCounterNumberInteger()
- throws Exception
- {
- on( TestBean.class ).invokeStatic( "incrementCounter" ).with( argument( Number.class,
- new Integer( 8 ) ) ).get();
+ throws Exception {
+ 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() );
+ assertEquals(oldValue + 8 * 2, TestBean.currentCounter());
}
@Test(expected = NoSuchBeanMethodException.class)
public void invokeStaticMethodWithInvalidArgument()
- throws Exception
- {
+ throws Exception {
String methodName = "incrementCounter";
- on( TestBean.class ).invokeStatic( methodName ).with( argument( 'x' ) );
+ on(TestBean.class).invokeStatic(methodName).with(argument('x'));
}
@Test
- public void invokeExactStaticMethodIncrementCounter() throws Exception
- {
- on( TestBean.class ).invokeExactStatic( "incrementCounter" ).with();
- assertEquals( oldValue + 1, TestBean.currentCounter() );
+ public void invokeExactStaticMethodIncrementCounter() throws Exception {
+ on(TestBean.class).invokeExactStatic("incrementCounter").with();
+ assertEquals(oldValue + 1, TestBean.currentCounter());
}
@Test
public void invokeExactStaticMethodIncrementIntegerPrimitive()
- throws Exception
- {
- on( TestBean.class ).invokeExactStatic( "incrementCounter" ).with( argument( int.class, 8 ) ).get();
- assertEquals( oldValue + 8, TestBean.currentCounter() );
+ throws Exception {
+ on(TestBean.class).invokeExactStatic("incrementCounter").with(argument(int.class, 8)).get();
+ assertEquals(oldValue + 8, TestBean.currentCounter());
}
- @Test( expected = NoSuchBeanMethodException.class )
+ @Test(expected = NoSuchBeanMethodException.class)
public void invokeExactStaticMethodIncrementIntegerWrapper()
- throws Exception
- {
- on( TestBean.class ).invokeExactStatic( "incrementCounter" ).with( argument( new Integer( 8 ) ) ).get();
+ throws Exception {
+ on(TestBean.class).invokeExactStatic("incrementCounter").with(argument(new Integer(8))).get();
}
@Test
public void invokeExactStaticMethodIncrementNumberInteger()
- throws Exception
- {
- on( TestBean.class ).invokeExactStatic( "incrementCounter" ).with( argument( Number.class,
- new Integer( 8 ) ) ).get();
+ throws Exception {
+ 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() );
+ assertEquals(oldValue + 2 * 8, TestBean.currentCounter());
}
@Test(expected = MethodInvocationException.class)
public void invokeStaticExceptionMethod()
- throws Exception
- {
- on( ThrowingExceptionBean.class ).invokeStatic( "staticException" ).with( argument( "Exception" ) );
+ throws Exception {
+ on(ThrowingExceptionBean.class).invokeStatic("staticException").with(argument("Exception"));
}
- @Test( expected = MethodInvocationException.class )
+ @Test(expected = MethodInvocationException.class)
public void invokeExactStaticExceptionMethod()
- throws Exception
- {
- on( ThrowingExceptionBean.class ).invokeExactStatic( "staticException" ).with( argument( "Exception" ) );
+ throws Exception {
+ on(ThrowingExceptionBean.class).invokeExactStatic("staticException").with(argument("Exception"));
}
}