#86997 Provide not persistent impl. of Preferences for tests
1.1 --- a/openide.util/src/org/openide/util/doc-files/preferences.html Thu Oct 12 17:30:05 2006 +0000
1.2 +++ b/openide.util/src/org/openide/util/doc-files/preferences.html Fri Oct 13 12:34:20 2006 +0000
1.3 @@ -215,5 +215,18 @@
1.4 (See as an example: <A HREF="http://www.netbeans.org/source/browse/ide/launcher/upgrade/src/org/netbeans/upgrade/systemoptions/TaskTagsProcessor.java?view=markup">TaskTagsProcessor</A>
1.5 and here is a <A
1.6 HREF="http://www.netbeans.org/source/browse/ide/launcher/upgrade/test/unit/src/org/netbeans/upgrade/systemoptions/ExampleSettingsTest.java?view=markup">test</A>).
1.7 + <H4 ALIGN=LEFT>How to write tests that needs Preferences API?</H4>
1.8 + Not persistent implementation of <code>java.util.prefs.Preferences</code>
1.9 + is installed in place of the platform-specific default implementation for
1.10 + running tests which is in spirit of unit testing because individual tests
1.11 + shouldn't interact. But if this behaviour isn't suitable then there is possible
1.12 + to reinstall platform-specific default implementation again:
1.13 +<PRE>
1.14 ++ public void run(final TestResult result) {
1.15 ++ //just initialize Preferences before code NbTestCase
1.16 ++ Preferences.userRoot();
1.17 ++ super.run(result);
1.18 ++ }
1.19 +</PRE>
1.20 </body>
1.21 </html>