Preference test cleanup
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/AllTests.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/AllTests.java
index aeb08e1..214350e 100644
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/AllTests.java
+++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/AllTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2012 IBM Corporation and others.
+ * Copyright (c) 2004, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,11 +11,11 @@
package org.eclipse.core.tests.internal.preferences;
import junit.framework.*;
+import org.eclipse.core.tests.runtime.*;
public class AllTests extends TestCase {
/**
* AllTests constructor comment.
- * @param name java.lang.String
*/
public AllTests() {
super(null);
@@ -36,6 +36,9 @@
suite.addTest(IScopeContextTest.suite());
suite.addTest(ListenerRegistryTest.suite());
suite.addTest(TestBug388004.suite());
+ suite.addTest(PreferenceExportTest.suite());
+ suite.addTest(PreferenceForwarderTest.suite());
+ suite.addTest(PreferencesTest.suite());
return suite;
}
}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/PreferencesServiceTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/PreferencesServiceTest.java
index 703e90e..2f7b685 100644
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/PreferencesServiceTest.java
+++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/PreferencesServiceTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2012 IBM Corporation and others.
+ * Copyright (c) 2004, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -712,7 +712,7 @@
}
/**
- * Tests a default preference value set by a preference intializer extension.
+ * Tests a default preference value set by a preference initializer extension.
*/
public void testDefaultFromInitializer() {
String value = Platform.getPreferencesService().getString(RuntimeTestsPlugin.PI_RUNTIME_TESTS, TestInitializer.DEFAULT_PREF_KEY, null, null);
@@ -760,6 +760,9 @@
verifier.addExpected(child2.absolutePath(), k2);
}
+ /**
+ * @deprecated this tests deprecated functions, so deprecation added to avoid warnings
+ */
public void testValidateVersions() {
final char BUNDLE_VERSION_PREFIX = '@';
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/TestInitializer.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/TestInitializer.java
index 607a864..fa1ed48 100644
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/TestInitializer.java
+++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/TestInitializer.java
@@ -14,7 +14,7 @@
import org.eclipse.core.tests.runtime.RuntimeTestsPlugin;
/**
- * Assigns some default preference values using intializer extension that
+ * Assigns some default preference values using initializer extension that
* are later verified by tests.
*/
public class TestInitializer extends AbstractPreferenceInitializer {
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/AllTests.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/AllTests.java
index 1604b7c..7386c48 100644
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/AllTests.java
+++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/AllTests.java
@@ -32,9 +32,6 @@
suite.addTest(PathTest.suite());
suite.addTest(PlatformTest.suite());
suite.addTest(PluginVersionIdentifierTest.suite());
- suite.addTest(PreferenceExportTest.suite());
- suite.addTest(PreferenceForwarderTest.suite());
- suite.addTest(PreferencesTest.suite());
suite.addTestSuite(SubMonitorTest.class);
suite.addTestSuite(SubProgressTest.class);
suite.addTestSuite(SubMonitorSmallTicksTest.class);
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PreferenceExportTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PreferenceExportTest.java
index 94d35b1..6e87d43 100644
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PreferenceExportTest.java
+++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PreferenceExportTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,6 +16,8 @@
/**
* Tests the Preferences import/export feature.
+ * @deprecated This class tests intentionally tests deprecated functionality, so tag
+ * added to hide deprecation reference warnings.
*/
public class PreferenceExportTest extends RuntimeTest {
public static Test suite() {
@@ -37,17 +39,13 @@
protected void tearDown() throws Exception {
super.tearDown();
- //remove all properties from runtime tests plugin
+ //remove properties modified by this test
Plugin testPlugin = Platform.getPlugin(PI_RUNTIME_TESTS);
Preferences prefs = testPlugin.getPluginPreferences();
- String[] defaultNames = prefs.defaultPropertyNames();
- for (int i = 0; i < defaultNames.length; i++) {
- prefs.setDefault(defaultNames[i], Preferences.STRING_DEFAULT_DEFAULT);
- }
- String[] names = prefs.propertyNames();
- for (int i = 0; i < names.length; i++) {
- prefs.setToDefault(names[i]);
- }
+ prefs.setDefault("SomeTestKey", Preferences.STRING_DEFAULT_DEFAULT);
+ prefs.setDefault("SomeOtherTestKey", Preferences.STRING_DEFAULT_DEFAULT);
+ prefs.setToDefault("SomeTestKey");
+ prefs.setToDefault("SomeOtherTestKey");
testPlugin.savePluginPreferences();
}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PreferenceForwarderTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PreferenceForwarderTest.java
index 76790cb..5e9decc 100644
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PreferenceForwarderTest.java
+++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PreferenceForwarderTest.java
@@ -25,6 +25,8 @@
/**
* Test suite for API class org.eclipse.core.runtime.Preferences
+ * @deprecated This class tests intentionally tests deprecated functionality, so tag
+ * added to hide deprecation reference warnings.
*/
public class PreferenceForwarderTest extends RuntimeTest {
@@ -71,9 +73,9 @@
// all test methods are named "test..."
return new TestSuite(PreferenceForwarderTest.class);
-// TestSuite suite = new TestSuite();
-// suite.addTest(new PreferenceForwarderTest("testListenerOnRemove"));
-// return suite;
+ // TestSuite suite = new TestSuite();
+ // suite.addTest(new PreferenceForwarderTest("testListenerOnRemove"));
+ // return suite;
}
/*
@@ -369,7 +371,7 @@
assertEquals("1.6", false, ps.contains("b"));
ps.setToDefault("a");
assertEquals("1.7", true, ps.contains("a"));
-
+
// test bug 62586
// fail gracefully in PreferenceForwarder.contains(null)
try {
@@ -840,17 +842,17 @@
String id = getUniqueString();
Preferences ps = new PreferenceForwarder(id);
ps.setValue("key", "value");
-
+
// add a property change listener which will cause one to be
// added at the preference node level
- IPropertyChangeListener listener = new Preferences.IPropertyChangeListener(){
+ IPropertyChangeListener listener = new Preferences.IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
}
};
ps.addPropertyChangeListener(listener);
ps.setValue("key2", "value2");
IEclipsePreferences node = new InstanceScope().getNode(id);
-
+
// add our log listener and remove the node. nothing should be logged.
RuntimeLog.addLogListener(logListener);
try {