ich soll einen Junit test für die methode
boolean nodeExists(String pathName) throws BackingStoreException
machen
Returns true if the named node exists. Accepts a relative or absolute pathname. Absolute pathnames (which begin with '/') are interpreted relative to the root of this node. Relative pathnames (which begin with any character other than '/') are interpreted relative to this node itself. The pathname "" is valid, and refers to this node itself.
If this node (or an ancestor) has already been removed with the removeNode() method, it is legal to invoke this method, but only with the pathname ""; the invocation will return false. Thus, the idiom p.nodeExists("") may be used to test whether p has been removed.
Parameters:
pathName the path name of the node whose existence is to be checked.
Returns:
true if the specified node exists.
Throws:
BackingStoreException - if this operation cannot be completed due to a failure in the backing store, or inability to communicate with it.
IllegalStateException - if this node (or an ancestor) has been removed with the removeNode() method and pathname is not the empty string ("").
IllegalArgumentException - if the path name is invalid (i.e., it contains multiple consecutive slash characters, or ends with a slash character and is more than one character long).
ich habe erstmal zwei tests geschrieben und würde gern wissen,ob die richtig sind!?!
kann mir jemand helfen!?
Java:
@Test
public void testNodesExistsRelativePath() throws Exception {
Preferences a = simple.node("a/b/c");
boolean nodeExists = a.nodeExists("b/c");
assertTrue(nodeExists);
}
@Test
public void testNodeExistsRelativePath() throws Exception {
Preferences a = simple.node("a/b/c");
boolean nodeExists = a.nodeExists("b");
assertTrue(nodeExists);
}