@Test public void testWrongOrder() throws Exception { TestMethodAdapter adapter = new TestMethodAdapter(); adapter.setTargetMethod("disorder"); adapter.setTargetObject(new PlainPojo()); assertEquals("2.0.foo", adapter.getMessage(2, "foo")); }
@Test public void testEmptyParameters() throws Exception { TestMethodAdapter adapter = new TestMethodAdapter(); adapter.setTargetMethod("empty"); adapter.setTargetObject(new PlainPojo()); assertEquals(".", adapter.getMessage(2, "foo")); }
@Test public void testTwoArgsOfSameTypeWithInexactMatch() throws Exception { HippyMethodInvoker invoker = new HippyMethodInvoker(); invoker.setTargetMethod("duplicate"); invoker.setTargetObject(new PlainPojo()); invoker.setArguments(new Object[] { "2", "foo" }); invoker.prepare(); assertEquals("foo.2", invoker.invoke()); }
@Test public void testMissingArgument() throws Exception { TestMethodAdapter adapter = new TestMethodAdapter(); adapter.setTargetMethod("missing"); adapter.setTargetObject(new PlainPojo()); assertEquals("foo.foo", adapter.getMessage(2, "foo")); }
@Test public void testVanillaMethodInvoker() throws Exception { TestMethodAdapter adapter = new TestMethodAdapter(); adapter.setTargetMethod("handle"); adapter.setTargetObject(new PlainPojo()); assertEquals("2.0.foo", adapter.getMessage(2, "foo")); }
@Test public void testEmptyParametersEmptyArgs() throws Exception { TestMethodAdapter adapter = new TestMethodAdapter(); adapter.setTargetMethod("empty"); adapter.setTargetObject(new PlainPojo()); assertEquals(".", adapter.getMessage()); }