11/*
2- * Copyright 2002-2014 the original author or authors.
2+ * Copyright 2002-2017 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -140,15 +140,15 @@ public void testGetObjectType() throws Exception {
140140 mcfb .setTargetMethod ("voidRetvalMethod" );
141141 mcfb .afterPropertiesSet ();
142142 Class <?> objType = mcfb .getObjectType ();
143- assertTrue (objType . equals ( void .class ) );
143+ assertSame (objType , void .class );
144144
145145 // verify that we can call a method with args that are subtypes of the
146146 // target method arg types
147147 TestClass1 ._staticField1 = 0 ;
148148 mcfb = new MethodInvokingFactoryBean ();
149149 mcfb .setTargetClass (TestClass1 .class );
150150 mcfb .setTargetMethod ("supertypes" );
151- mcfb .setArguments (new Object [] { new ArrayList <Object >(), new ArrayList <Object >(), "hello" } );
151+ mcfb .setArguments (new ArrayList <>(), new ArrayList <Object >(), "hello" );
152152 mcfb .afterPropertiesSet ();
153153 mcfb .getObjectType ();
154154
@@ -157,7 +157,7 @@ public void testGetObjectType() throws Exception {
157157 mcfb .registerCustomEditor (String .class , new StringTrimmerEditor (false ));
158158 mcfb .setTargetClass (TestClass1 .class );
159159 mcfb .setTargetMethod ("supertypes" );
160- mcfb .setArguments (new Object [] { "1" , new Object ()} );
160+ mcfb .setArguments ("1" , new Object ());
161161 try {
162162 mcfb .afterPropertiesSet ();
163163 fail ("Should have thrown NoSuchMethodException" );
@@ -225,7 +225,7 @@ public void testGetObject() throws Exception {
225225 mcfb = new MethodInvokingFactoryBean ();
226226 mcfb .setTargetClass (TestClass1 .class );
227227 mcfb .setTargetMethod ("supertypes" );
228- mcfb .setArguments (new Object [] { new ArrayList <Object >(), new ArrayList <Object >(), "hello" } );
228+ mcfb .setArguments (new ArrayList <>(), new ArrayList <Object >(), "hello" );
229229 // should pass
230230 mcfb .afterPropertiesSet ();
231231 }
@@ -235,7 +235,7 @@ public void testArgumentConversion() throws Exception {
235235 MethodInvokingFactoryBean mcfb = new MethodInvokingFactoryBean ();
236236 mcfb .setTargetClass (TestClass1 .class );
237237 mcfb .setTargetMethod ("supertypes" );
238- mcfb .setArguments (new Object [] { new ArrayList <Object >(), new ArrayList <Object >(), "hello" , "bogus" } );
238+ mcfb .setArguments (new ArrayList <>(), new ArrayList <Object >(), "hello" , "bogus" );
239239 try {
240240 mcfb .afterPropertiesSet ();
241241 fail ("Matched method with wrong number of args" );
@@ -247,7 +247,7 @@ public void testArgumentConversion() throws Exception {
247247 mcfb = new MethodInvokingFactoryBean ();
248248 mcfb .setTargetClass (TestClass1 .class );
249249 mcfb .setTargetMethod ("supertypes" );
250- mcfb .setArguments (new Object [] { 1 , new Object ()} );
250+ mcfb .setArguments (1 , new Object ());
251251 try {
252252 mcfb .afterPropertiesSet ();
253253 mcfb .getObject ();
@@ -260,14 +260,14 @@ public void testArgumentConversion() throws Exception {
260260 mcfb = new MethodInvokingFactoryBean ();
261261 mcfb .setTargetClass (TestClass1 .class );
262262 mcfb .setTargetMethod ("supertypes2" );
263- mcfb .setArguments (new Object [] { new ArrayList <Object >(), new ArrayList <Object >(), "hello" , "bogus" } );
263+ mcfb .setArguments (new ArrayList <>(), new ArrayList <Object >(), "hello" , "bogus" );
264264 mcfb .afterPropertiesSet ();
265265 assertEquals ("hello" , mcfb .getObject ());
266266
267267 mcfb = new MethodInvokingFactoryBean ();
268268 mcfb .setTargetClass (TestClass1 .class );
269269 mcfb .setTargetMethod ("supertypes2" );
270- mcfb .setArguments (new Object [] { new ArrayList <Object >(), new ArrayList <Object >(), new Object ()} );
270+ mcfb .setArguments (new ArrayList <>(), new ArrayList <Object >(), new Object ());
271271 try {
272272 mcfb .afterPropertiesSet ();
273273 fail ("Matched method when shouldn't have matched" );
@@ -292,14 +292,14 @@ public void testInvokeWithIntArgument() throws Exception {
292292 ArgumentConvertingMethodInvoker methodInvoker = new ArgumentConvertingMethodInvoker ();
293293 methodInvoker .setTargetClass (TestClass1 .class );
294294 methodInvoker .setTargetMethod ("intArgument" );
295- methodInvoker .setArguments (new Object [] { 5 } );
295+ methodInvoker .setArguments (5 );
296296 methodInvoker .prepare ();
297297 methodInvoker .invoke ();
298298
299299 methodInvoker = new ArgumentConvertingMethodInvoker ();
300300 methodInvoker .setTargetClass (TestClass1 .class );
301301 methodInvoker .setTargetMethod ("intArgument" );
302- methodInvoker .setArguments (new Object [] { "5" } );
302+ methodInvoker .setArguments (5 );
303303 methodInvoker .prepare ();
304304 methodInvoker .invoke ();
305305 }
@@ -309,37 +309,37 @@ public void testInvokeWithIntArguments() throws Exception {
309309 MethodInvokingBean methodInvoker = new MethodInvokingBean ();
310310 methodInvoker .setTargetClass (TestClass1 .class );
311311 methodInvoker .setTargetMethod ("intArguments" );
312- methodInvoker .setArguments (new Object []{new Integer [] {5 , 10 }});
312+ methodInvoker .setArguments (new Object [] {new Integer [] {5 , 10 }});
313313 methodInvoker .afterPropertiesSet ();
314314
315315 methodInvoker = new MethodInvokingBean ();
316316 methodInvoker .setTargetClass (TestClass1 .class );
317317 methodInvoker .setTargetMethod ("intArguments" );
318- methodInvoker .setArguments (new Object []{new String []{"5" , "10" }});
318+ methodInvoker .setArguments (new Object [] {new String [] {"5" , "10" }});
319319 methodInvoker .afterPropertiesSet ();
320320
321321 methodInvoker = new MethodInvokingBean ();
322322 methodInvoker .setTargetClass (TestClass1 .class );
323323 methodInvoker .setTargetMethod ("intArguments" );
324- methodInvoker .setArguments (new Object []{new Integer [] {5 , 10 }});
324+ methodInvoker .setArguments (new Object [] {new Integer [] {5 , 10 }});
325325 methodInvoker .afterPropertiesSet ();
326326
327327 methodInvoker = new MethodInvokingBean ();
328328 methodInvoker .setTargetClass (TestClass1 .class );
329329 methodInvoker .setTargetMethod ("intArguments" );
330- methodInvoker .setArguments (new String []{ "5" , "10" } );
330+ methodInvoker .setArguments ("5" , "10" );
331331 methodInvoker .afterPropertiesSet ();
332332
333333 methodInvoker = new MethodInvokingBean ();
334334 methodInvoker .setTargetClass (TestClass1 .class );
335335 methodInvoker .setTargetMethod ("intArguments" );
336- methodInvoker .setArguments (new Object []{new Integer [] {5 , 10 }});
336+ methodInvoker .setArguments (new Object [] {new Integer [] {5 , 10 }});
337337 methodInvoker .afterPropertiesSet ();
338338
339339 methodInvoker = new MethodInvokingBean ();
340340 methodInvoker .setTargetClass (TestClass1 .class );
341341 methodInvoker .setTargetMethod ("intArguments" );
342- methodInvoker .setArguments (new Object []{ "5" , "10" } );
342+ methodInvoker .setArguments ("5" , "10" );
343343 methodInvoker .afterPropertiesSet ();
344344 }
345345
0 commit comments