First-class objects are the norm in the code that I usually write and edit, but every now and then I run across a method with a primitive parameter. I use EasyMock a lot in testing, and need to find these methods by reflection, this is how it’s done…
1 2 3 4 5 6
will be able to find the method here:
1 2 3
Notice, that object params use: Integer.class
Primitive params use: Integer.TYPE
The one other thing that bugs me with this reflection bit is the string representation of the test() method name. So, when the test() method name changes to test2(), the unit test will break. Blast! Hence, the standard out message.