harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r498946 - /harmony/enhanced/classlib/trunk/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferencesTest.java
Date Tue, 23 Jan 2007 08:00:27 GMT
Author: smishura
Date: Tue Jan 23 00:00:24 2007
New Revision: 498946

URL: http://svn.apache.org/viewvc?view=rev&rev=498946
Log:
Apply modified patch for test from HARMONY-1751:
[classlib][prefs] Classlib test org.apache.harmony.prefs.tests.java.util.prefs.PreferencesTest.testSystemNodeForPackage()
fails

Modified:
    harmony/enhanced/classlib/trunk/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferencesTest.java

Modified: harmony/enhanced/classlib/trunk/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferencesTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferencesTest.java?view=diff&rev=498946&r1=498945&r2=498946
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferencesTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferencesTest.java
Tue Jan 23 00:00:24 2007
@@ -59,7 +59,13 @@
 	}
 
 	public void testSystemNodeForPackage() throws BackingStoreException {
-		Preferences p = Preferences.systemNodeForPackage(Object.class);
+		Preferences p = null;
+        try {
+            p = Preferences.systemNodeForPackage(Object.class);
+        } catch (SecurityException e) {
+            // may be caused by absence of privileges on the underlying OS 
+            return;
+        }
 		assertEquals("/java/lang", p.absolutePath());
 		assertTrue(p instanceof AbstractPreferences);
 		Preferences root = Preferences.systemRoot();
@@ -69,14 +75,27 @@
 		assertEquals("lang", p.name());
 		assertEquals("System Preference Node: " + p.absolutePath(), p
 				.toString());
-		assertEquals(0, p.childrenNames().length);
-		assertEquals(0, p.keys().length);
-		parent.removeNode();
-		try {
-			p = Preferences.userNodeForPackage(null);
-			fail();
-		} catch (NullPointerException e) {
-		}
+        try {
+            assertEquals(0, p.childrenNames().length);
+        } catch (BackingStoreException e) {
+            // could be thrown according to specification
+        }
+        try {
+            assertEquals(0, p.keys().length);
+        } catch (BackingStoreException e) {
+            // could be thrown according to specification
+        }
+        try {
+            parent.removeNode();
+        } catch (BackingStoreException e) {
+            // could be thrown according to specification
+        }
+        try {
+            p = Preferences.userNodeForPackage(null);
+            fail("NullPointerException has not been thrown");
+        } catch (NullPointerException e) {
+            // expected
+        }
 	}
 
 	public void testSystemRoot() throws BackingStoreException {



Mime
View raw message