Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 12841 invoked from network); 24 Jul 2006 07:54:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 24 Jul 2006 07:54:23 -0000 Received: (qmail 9742 invoked by uid 500); 24 Jul 2006 07:54:19 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 9702 invoked by uid 500); 24 Jul 2006 07:54:18 -0000 Mailing-List: contact harmony-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-commits@incubator.apache.org Received: (qmail 9675 invoked by uid 99); 24 Jul 2006 07:54:18 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Jul 2006 00:54:18 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Jul 2006 00:54:17 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 7B58C1A981A; Mon, 24 Jul 2006 00:53:57 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r424952 - in /incubator/harmony/enhanced/classlib/trunk/modules/beans: build.xml src/test/java/org/apache/harmony/beans/tests/java/beans/StatementTest.java Date: Mon, 24 Jul 2006 07:53:56 -0000 To: harmony-commits@incubator.apache.org From: mloenko@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060724075357.7B58C1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: mloenko Date: Mon Jul 24 00:53:54 2006 New Revision: 424952 URL: http://svn.apache.org/viewvc?rev=424952&view=rev Log: fixes for HARMONY-952 [classlib][beans] final clean up of StatementTest (6) Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/build.xml incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/StatementTest.java Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/build.xml URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/build.xml?rev=424952&r1=424951&r2=424952&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/beans/build.xml (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/beans/build.xml Mon Jul 24 00:53:54 2006 @@ -224,7 +224,6 @@ - Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/StatementTest.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/StatementTest.java?rev=424952&r1=424951&r2=424952&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/StatementTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/StatementTest.java Mon Jul 24 00:53:54 2006 @@ -354,6 +354,19 @@ } /* + * Test the method execute() with a normal object, normal method and null + * arguments. + */ + public void testExecute_NormalInstanceMethodNull() throws Exception { + MockObject mo = new MockObject(false); + Object[] arguments = new Object[] { null, null, null }; + Statement t = new Statement(mo, "method", arguments); + + t.execute(); + MockObject.assertCalled("method5", arguments); + } + + /* * Test the method execute() with a normal object, a valid method that * throws an exception and valid arguments. */ @@ -454,18 +467,6 @@ } /* - * Test the method execute() with a normal object, an overloaded method and - * null arguments. See Java Language Specification (15.11) for reference. - */ - public void testExecute_OverloadedMethodsNull() throws Exception { - MockObject mo = new MockObject(false); - Object[] arguments = new Object[] { null }; - Statement t = new Statement(mo, "method", arguments); - t.execute(); - MockObject.assertCalled("method1-2", arguments); - } - - /* * Test the method execute() with a normal object, the method name "new" and * valid arguments. */ @@ -479,6 +480,23 @@ } /* + * Test the method execute() with a normal object, normal constructor ("new" + * method) and null arguments. + */ + public void testExecute_NormalConstructorNull() throws Exception { + Object[] arguments = new Object[] { null, null }; + Statement t = new Statement(MockObject.class, "new", arguments); + + try { + t.execute(); + fail("Should throw NullPointerException!"); + } catch (NullPointerException ex) { + // expected + } + MockObject.assertCalled("new4", arguments); + } + + /* * Test the method execute() with a normal object, the method name "new" * that throws an exception and valid arguments. */ @@ -500,7 +518,8 @@ */ public void testExecute_NonExistingConstructor() throws Exception { Statement t = new Statement(MockObject.class, "new", new Object[] { - null, null, null }); + null, null, null, null }); + try { t.execute(); fail("Should throw NoSuchMethodException!"); @@ -522,7 +541,8 @@ arguments = new Object[] { "test" }; t = new Statement(MockObject.class, "new", arguments); t.execute(); - // MockObject.assertCalled("new2", arguments); + // XXX RI calls new2 here, not the most specific constructor. Bug in RI? + // MockObject.assertCalled("new3", arguments); arguments = new Object[] { new Integer(1) }; t = new Statement(MockObject.class, "new", arguments); @@ -531,22 +551,6 @@ } /* - * Test the method execute() with a normal object with overloaded - * constructors, the method name "new" and null arguments. - */ - public void testExecute_OverloadedConstructorsNull() throws Exception { - Object[] arguments = new Object[] { null }; - Statement t = new Statement(MockObject.class, "new", arguments); - try { - t.execute(); - fail("Should throw NullPointerException!"); - } catch (NullPointerException ex) { - // expected - } - // MockObject.assertCalled("new2", arguments); - } - - /* * Test the method execute() with the Class object, a static method name and * valid arguments. */ @@ -589,7 +593,7 @@ * Test the method execute() with the special method Class.forName(). */ public void testExecute_ClassForName() throws Exception { - Object[] arguments = new String[] { this.getClass().getName() }; + Object[] arguments = new String[] { Statement.class.getName() }; Statement t = new Statement(Class.class, "forName", arguments); t.execute(); @@ -765,30 +769,29 @@ * * Note: decided by definition position! */ - public void testExecute_EqualSpecificMethods() throws Exception { - MockObject mo = new MockObject(false); - Object[] arguments = new Object[] { new MockObject(false), - new MockObject(false) }; - Statement t = new Statement(mo, "equalSpecificMethod", arguments); - t.execute(); - MockObject.assertCalled("equalSpecificMethod1", arguments); - } - + // public void testExecute_EqualSpecificMethods() throws Exception { + // MockObject mo = new MockObject(false); + // Object[] arguments = new Object[] { new MockObject(false), + // new MockObject(false) }; + // Statement t = new Statement(mo, "equalSpecificMethod", arguments); + // t.execute(); + // MockObject.assertCalled("equalSpecificMethod1", arguments); + // } /* * Test the method execute() with two equal specific methods but one * declaring thrown exception. * * Note: decided by definition position! */ - public void testExecute_EqualSpecificMethodsException() throws Exception { - MockObject mo = new MockObject(false); - Object[] arguments = new Object[] { new MockObject(false), - new MockObject(false), new Object() }; - Statement t = new Statement(mo, "equalSpecificMethod", arguments); - t.execute(); - MockObject.assertCalled("equalSpecificMethod4", arguments); - } - + // public void testExecute_EqualSpecificMethodsException() throws Exception + // { + // MockObject mo = new MockObject(false); + // Object[] arguments = new Object[] { new MockObject(false), + // new MockObject(false), new Object() }; + // Statement t = new Statement(mo, "equalSpecificMethod", arguments); + // t.execute(); + // MockObject.assertCalled("equalSpecificMethod4", arguments); + // } /* * Test the method execute() with int method while providing a null * parameter. @@ -799,8 +802,8 @@ Statement t = new Statement(mo, "intMethod", arguments); try { t.execute(); - fail("Should throw NullPointerException!"); - } catch (NullPointerException ex) { + fail("Should throw NoSuchMethodException!"); + } catch (NoSuchMethodException ex) { // expected } } @@ -889,6 +892,14 @@ throw new NullPointerException(); } + public void method(Object o, Number n, String s) { + reset(); + calledMethod = "method5"; + receivedArguments.add(o); + receivedArguments.add(n); + receivedArguments.add(s); + } + public static void reset() { receivedArguments.clear(); calledMethod = null; @@ -938,6 +949,14 @@ throw new NullPointerException(); } + public MockObject(Object o, Vector v, Class c) { + reset(); + calledMethod = "new5"; + receivedArguments.add(o); + receivedArguments.add(v); + receivedArguments.add(c); + } + public void intMethod(int i) { reset(); calledMethod = "intMethod"; @@ -974,36 +993,38 @@ receivedArguments.add(o); } - public void equalSpecificMethod(MockObject o, MockParent p) { - reset(); - calledMethod = "equalSpecificMethod1"; - receivedArguments.add(o); - receivedArguments.add(p); - } - - public void equalSpecificMethod(MockParent p, MockObject o) { - reset(); - calledMethod = "equalSpecificMethod2"; - receivedArguments.add(p); - receivedArguments.add(o); - } - - public void equalSpecificMethod(MockParent p, MockObject o, Object o2) - throws Exception { - reset(); - calledMethod = "equalSpecificMethod4"; - receivedArguments.add(p); - receivedArguments.add(o); - receivedArguments.add(o2); - } - - public void equalSpecificMethod(MockObject o, MockParent p, Object o2) { - reset(); - calledMethod = "equalSpecificMethod3"; - receivedArguments.add(o); - receivedArguments.add(p); - receivedArguments.add(o2); - } + // public void equalSpecificMethod(MockObject o, MockParent p) { + // reset(); + // calledMethod = "equalSpecificMethod1"; + // receivedArguments.add(o); + // receivedArguments.add(p); + // } + // + // public void equalSpecificMethod(MockParent p, MockObject o) { + // reset(); + // calledMethod = "equalSpecificMethod2"; + // receivedArguments.add(p); + // receivedArguments.add(o); + // } + // + // public void equalSpecificMethod(MockParent p, MockObject o, Object + // o2) + // throws Exception { + // reset(); + // calledMethod = "equalSpecificMethod4"; + // receivedArguments.add(p); + // receivedArguments.add(o); + // receivedArguments.add(o2); + // } + // + // public void equalSpecificMethod(MockObject o, MockParent p, Object + // o2) { + // reset(); + // calledMethod = "equalSpecificMethod3"; + // receivedArguments.add(o); + // receivedArguments.add(p); + // receivedArguments.add(o2); + // } public static Class forName(String o) { reset();