This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
MemoryPreferences would be needed for tests.
Created attachment 35132 [details] patch
I'm going to apply this patch.
No! Do not override setUp in NbTestCase, if you add new method into that class, make sure it has javadoc, and is documented in apichanges. Anyway I am not sure that getPreferencesFactoryClass() is really the right API, what would people would use it for?
Don't like the API either. (Shouldn't this be assigned to apireviews?) MemoryPreferencesFactory by itself is enough, I think - should suffice to write protected void setUp() throws Exception { super.setUp(); MockServices.setServices(MemoryPreferencesFactory.class); } both for Preferences.* and NbPreferences.* factory methods. Please try it and see if that works.
Created attachment 35145 [details] Simplified, maybe no API neded
I don't acually think that someone should like to replace MemoryPreferencesFactory by anything else (neither default JDK impl.). So, maybe default registration of MemoryPreferencesFactory could be enough - see last attachment. Definitely System.setProperty("java.util.prefs.PreferencesFactory",... works but MockServices.setServices(MemoryPreferencesFactory.class) NOT.
Probably OK. I guess MockServices did not work because Preferences looks only in the system class loader, not the thread context class loader.
/cvs/xtest/nbjunit/manifest.mf,v <-- manifest.mf new revision: 1.20; previous revision: 1.19 /cvs/xtest/nbjunit/apichanges.xml,v <-- apichanges.xml new revision: 1.6; previous revision: 1.5 /cvs/xtest/nbjunit/src/org/netbeans/junit/NbTestCase.java,v <-- new revision: 1.58; previous revision: 1.57 /cvs/xtest/nbjunit/test/unit/src/org/netbeans/junit/NbTestCaseTest.java,v <-- new revision: 1.6; previous revision: 1.5 /cvs/core/startup/test/unit/src/org/netbeans/core/startup/preferences/NbPreferencesTest.java,v new revision: 1.3; previous revision: 1.2 xtest/nbjunit/src/org/netbeans/junit/internal/MemoryPreferencesFactory.java; /cvs/xtest/nbjunit/src/org/netbeans/junit/internal/MemoryPreferencesFactory.java,v initial revision: 1.1 /cvs/openide/util/src/org/openide/util/doc-files/preferences.html,v <-- new revision: 1.5; previous revision: 1.4