summaryrefslogtreecommitdiffstats
path: root/harmony-tests
diff options
context:
space:
mode:
authorNeil Fuller <nfuller@google.com>2014-09-17 15:44:31 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-09-17 15:44:31 +0000
commite1252379251b251d11f165471fe286099de8569c (patch)
treee66407eecc0f36fa3f9e624c2e98b20f968effa4 /harmony-tests
parent4cc1c67c065453aba33ddeb5b1910544a7f895f0 (diff)
parentbf5b79fd518a0a769f7fae74d8704bdebc744f03 (diff)
downloadlibcore-e1252379251b251d11f165471fe286099de8569c.zip
libcore-e1252379251b251d11f165471fe286099de8569c.tar.gz
libcore-e1252379251b251d11f165471fe286099de8569c.tar.bz2
am bf5b79fd: Merge "Fix FilePreferencesImplTest test initialization errors."
* commit 'bf5b79fd518a0a769f7fae74d8704bdebc744f03': Fix FilePreferencesImplTest test initialization errors.
Diffstat (limited to 'harmony-tests')
-rw-r--r--harmony-tests/src/test/java/org/apache/harmony/tests/java/util/prefs/FilePreferencesImplTest.java20
1 files changed, 5 insertions, 15 deletions
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/prefs/FilePreferencesImplTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/prefs/FilePreferencesImplTest.java
index d2b344e..352603c 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/prefs/FilePreferencesImplTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/prefs/FilePreferencesImplTest.java
@@ -26,31 +26,21 @@ import libcore.io.IoUtils;
public class FilePreferencesImplTest extends TestCase {
- private String prevFactory;
private Preferences uroot;
private Preferences sroot;
- private PreferencesFactory defaultFactory;
@Override
protected void setUp() throws Exception {
- prevFactory = System.getProperty("java.util.prefs.PreferencesFactory");
- System.setProperty("java.util.prefs.PreferencesFactory", "java.util.prefs.FilePreferencesFactoryImpl");
+ File tmpDir = IoUtils.createTemporaryDirectory("FilePreferencesImplTest");
+ AbstractPreferencesTest.TestPreferencesFactory factory
+ = new AbstractPreferencesTest.TestPreferencesFactory(tmpDir.getAbsolutePath());
- File tmpDir = IoUtils.createTemporaryDirectory("OldAbstractPreferencesTest");
- defaultFactory = Preferences.setPreferencesFactory(
- new AbstractPreferencesTest.TestPreferencesFactory(tmpDir.getAbsolutePath()));
-
- uroot = Preferences.userRoot().node("harmony_test");
- sroot = Preferences.systemRoot().node("harmony_test");
+ uroot = factory.userRoot().node("harmony_test");
+ sroot = factory.systemRoot().node("harmony_test");
}
@Override
protected void tearDown() throws Exception {
- Preferences.setPreferencesFactory(defaultFactory);
- if (prevFactory != null) {
- System.setProperty("java.util.prefs.PreferencesFactory", prevFactory);
- }
-
uroot.removeNode();
sroot.removeNode();
uroot = null;