本文整理匯總了Java中java.util.prefs.AbstractPreferences.node方法的典型用法代碼示例。如果您正苦於以下問題:Java AbstractPreferences.node方法的具體用法?Java AbstractPreferences.node怎麽用?Java AbstractPreferences.node使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.util.prefs.AbstractPreferences
的用法示例。
在下文中一共展示了AbstractPreferences.node方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testGetKey
import java.util.prefs.AbstractPreferences; //導入方法依賴的package包/類
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "Test is correct, functionality checked in separate Mock class.",
method = "getKey",
args = {}
)
public void testGetKey() {
AbstractPreferences parent = (AbstractPreferences) Preferences
.userNodeForPackage(Preferences.class);
AbstractPreferences pref = (AbstractPreferences) parent.node("mock");
MockPreferenceChangeListener pl = new MockPreferenceChangeListener(
MockPreferenceChangeListener.TEST_GET_KEY);
pref.addPreferenceChangeListener(pl);
try {
pref.putInt("key_int", Integer.MAX_VALUE);
assertEquals(1, pl.getChanged());
assertTrue(pl.getResult());
pl.reset();
} finally {
pref.removePreferenceChangeListener(pl);
}
}
示例2: testGetNode
import java.util.prefs.AbstractPreferences; //導入方法依賴的package包/類
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "Test is correct, functionality checked in separate Mock class.",
method = "getNode",
args = {}
)
public void testGetNode() {
AbstractPreferences parent = (AbstractPreferences) Preferences
.userNodeForPackage(Preferences.class);
AbstractPreferences pref = (AbstractPreferences) parent.node("mock");
MockPreferenceChangeListener pl = new MockPreferenceChangeListener(
MockPreferenceChangeListener.TEST_GET_NODE);
pref.addPreferenceChangeListener(pl);
try {
pref.putInt("key_int", Integer.MAX_VALUE);
assertEquals(1, pl.getChanged());
assertTrue(pl.getResult());
pl.reset();
} finally {
pref.removePreferenceChangeListener(pl);
}
}
示例3: testGetChild
import java.util.prefs.AbstractPreferences; //導入方法依賴的package包/類
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "Test is correct, functionality checked in separate Mock class.",
method = "getChild",
args = {}
)
public void testGetChild() throws BackingStoreException {
AbstractPreferences parent = (AbstractPreferences) Preferences
.userNodeForPackage(Preferences.class);
AbstractPreferences pref = (AbstractPreferences) parent.node("mock");
MockNodeChangeListener nl = new MockNodeChangeListener(
MockNodeChangeListener.TEST_GET_CHILD);
try {
pref.addNodeChangeListener(nl);
Preferences child1 = pref.node("mock1");
nl.waitForEvent();
assertEquals(1, nl.getAdded());
assertTrue(nl.getAddResult());
nl.reset();
child1.removeNode();
nl.waitForEvent();
assertEquals(1, nl.getRemoved());
assertTrue(nl.getRemoveResult());
nl.reset();
} finally {
pref.removeNodeChangeListener(nl);
}
}
示例4: testGetParent
import java.util.prefs.AbstractPreferences; //導入方法依賴的package包/類
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "Test is correct, functionality checked in separate Mock class.",
method = "getParent",
args = {}
)
public void testGetParent() throws BackingStoreException {
AbstractPreferences parent = (AbstractPreferences) Preferences
.userNodeForPackage(Preferences.class);
AbstractPreferences pref = (AbstractPreferences) parent.node("mock");
MockNodeChangeListener nl = new MockNodeChangeListener(
MockNodeChangeListener.TEST_GET_CHILD);
try {
pref.addNodeChangeListener(nl);
Preferences child1 = pref.node("mock1");
nl.waitForEvent();
assertEquals(1, nl.getAdded());
assertTrue(nl.getAddResult());
nl.reset();
child1.removeNode();
nl.waitForEvent();
assertEquals(1, nl.getRemoved());
assertTrue(nl.getRemoveResult());
nl.reset();
} finally {
pref.removeNodeChangeListener(nl);
}
}
示例5: testGetNewValue
import java.util.prefs.AbstractPreferences; //導入方法依賴的package包/類
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "Test is correct, functionality checked in separate Mock class.",
method = "getNewValue",
args = {}
)
public void testGetNewValue() {
AbstractPreferences parent = (AbstractPreferences) Preferences
.userNodeForPackage(Preferences.class);
AbstractPreferences pref = (AbstractPreferences) parent.node("mock");
MockPreferenceChangeListener pl = new MockPreferenceChangeListener(
MockPreferenceChangeListener.TEST_GET_NEW_VALUE);
pref.addPreferenceChangeListener(pl);
try {
pref.putInt("key_int", Integer.MAX_VALUE);
assertEquals(1, pl.getChanged());
assertTrue(pl.getResult());
pl.reset();
pref.putInt("key_int", Integer.MAX_VALUE);
assertEquals(1, pl.getChanged());
assertTrue(pl.getResult());
pl.reset();
} finally {
pref.removePreferenceChangeListener(pl);
}
}
示例6: setUp
import java.util.prefs.AbstractPreferences; //導入方法依賴的package包/類
protected void setUp() throws Exception {
super.setUp();
root = (AbstractPreferences) Preferences.userRoot();
parent = (AbstractPreferences) Preferences.userNodeForPackage(this.getClass());
pref = (AbstractPreferences) parent.node(nodeName);
}
示例7: setUp
import java.util.prefs.AbstractPreferences; //導入方法依賴的package包/類
@Override
protected void setUp() throws Exception {
super.setUp();
root = (AbstractPreferences) Preferences.userRoot();
parent = (AbstractPreferences) Preferences
.userNodeForPackage(Preferences.class);
// FIXME: change here is dangerous
// pref = new MockAbstractPreferences((AbstractPreferences) parent,
// "mock");
pref = (AbstractPreferences) parent.node("mock");
}
示例8: setUp
import java.util.prefs.AbstractPreferences; //導入方法依賴的package包/類
protected void setUp() throws Exception {
super.setUp();
root = (AbstractPreferences) Preferences.userRoot();
parent = (AbstractPreferences) Preferences
.userNodeForPackage(Preferences.class);
// FIXME: change here is dangerous
// pref = new MockAbstractPreferences((AbstractPreferences) parent,
// "mock");
pref = (AbstractPreferences) parent.node("mock");
}