Index: test/java/org/apache/harmony/beans/tests/java/beans/DefaultPersistenceDelegateTest.java =================================================================== --- test/java/org/apache/harmony/beans/tests/java/beans/DefaultPersistenceDelegateTest.java (revision 448164) +++ test/java/org/apache/harmony/beans/tests/java/beans/DefaultPersistenceDelegateTest.java (working copy) @@ -343,23 +343,25 @@ */ public void testInstantiate_NotRegularGetter() throws Exception { MockPersistenceDelegate pd = new MockPersistenceDelegate(new String[] { - "prop1", "i" }); + "prop"}); MockFoo2 b = new MockFoo2(2); Expression e = pd.instantiate(b, new Encoder()); - assertSame(b, e.getValue()); + + assertSame(b, e.getValue()); assertSame(MockFoo2.class, e.getTarget()); assertEquals("new", e.getMethodName()); - assertEquals(2, e.getArguments().length); + assertEquals(1, e.getArguments().length); assertEquals(new Integer(2), e.getArguments()[0]); - assertEquals(null, e.getArguments()[1]); - } + } + /* * Tests mutatesTo() under normal conditions without any properties. */ public void testMutatesTo_NormalNoProperty() { MockPersistenceDelegate pd = new MockPersistenceDelegate(); - assertTrue(pd.mutatesTo("test1", "test2")); + + assertTrue(pd.mutatesTo("test1", "test1")); assertFalse(pd.mutatesTo(new Object(), new Object() { public int hashCode() { return super.hashCode(); @@ -375,6 +377,7 @@ public void testMutatesTo_NormalWithPropertyNoEqualMethod() { MockPersistenceDelegate pd = new MockPersistenceDelegate( new String[] { "name" }); + assertFalse(pd.mutatesTo(new Object(), new Object() { public int hashCode() { return super.hashCode(); @@ -389,6 +392,7 @@ public void testMutatesTo_NormalWithNullPropertyPublicEqualMethod() { MockPersistenceDelegate pd = new MockPersistenceDelegate( new String[] { null }); + assertFalse(pd.mutatesTo("test1", "test2")); } @@ -398,7 +402,8 @@ */ public void testMutatesTo_NormalWithEmptyPropertyPublicEqualMethod() { MockPersistenceDelegate pd = new MockPersistenceDelegate(new String[0]); - assertTrue(pd.mutatesTo("test1", "test2")); + + assertTrue(pd.mutatesTo("test1", "test1")); } /* @@ -408,6 +413,7 @@ public void testMutatesTo_NormalWithPropertyPublicEqualMethod() { MockPersistenceDelegate pd = new MockPersistenceDelegate( new String[] { "name" }); + assertFalse(pd.mutatesTo("test1", "test2")); assertTrue(pd.mutatesTo("test1", "test1")); } @@ -419,6 +425,7 @@ public void testMutatesTo_NormalWithPropertyProtectedEqualMethod() { MockPersistenceDelegate pd = new MockPersistenceDelegate( new String[] { "name" }); + assertFalse(pd.mutatesTo(new MockPersistenceDelegate(), "test")); } @@ -427,14 +434,10 @@ */ public void testMutatesTo_Null() { MockPersistenceDelegate pd = new MockPersistenceDelegate(); + assertFalse(pd.mutatesTo("test", null)); assertFalse(pd.mutatesTo(null, null)); - try { - pd.mutatesTo(null, "test"); - fail("Should throw NullPointerException!"); - } catch (NullPointerException ex) { - // expected - } + assertFalse(pd.mutatesTo(null, "test")); } /* Index: test/support/java/org/apache/harmony/beans/tests/support/mock/MockFoo2BeanInfo.java =================================================================== --- test/support/java/org/apache/harmony/beans/tests/support/mock/MockFoo2BeanInfo.java (revision 448164) +++ test/support/java/org/apache/harmony/beans/tests/support/mock/MockFoo2BeanInfo.java (working copy) @@ -25,16 +25,15 @@ public class MockFoo2BeanInfo extends SimpleBeanInfo { public PropertyDescriptor[] getPropertyDescriptors() { - PropertyDescriptor[] pds = new PropertyDescriptor[1]; + PropertyDescriptor pd = null; + try { - PropertyDescriptor pd = new PropertyDescriptor("prop", + pd = new PropertyDescriptor("prop", MockFoo2.class, "myget", "myset"); - pd.setName(pd.getName() + ".BeanInfo"); - pds[0] = pd; } catch (IntrospectionException e) { throw new Error(e); } - return pds; + return new PropertyDescriptor[] { pd }; } }