### Question:
JcrTools { public Node getNode( Node node, String relativePath, boolean required ) throws RepositoryException { CheckArg.isNotNull(node, "node"); CheckArg.isNotNull(relativePath, "relativePath"); Node result = null; try { result = node.getNode(relativePath); } catch (PathNotFoundException e) { if (required) { throw e; } } return result; }  int removeAllChildren( Node node ); Node getNode( Node node,
                         String relativePath,
                         boolean required ); String getReadable( Node node ); MimeTypeDetector mimeTypeDetector( Session session ); String detectMimeType( Session session,
                                  String fileName ); String detectMimeType( Session session,
                                  File file,
                                  boolean useContent ); String detectMimeType( Session session,
                                  URL url,
                                  boolean useContent ); Node uploadFile( Session session,
                            String path,
                            InputStream stream ); Node uploadFile( Session session,
                            String path,
                            URL contentUrl ); Node uploadFile( Session session,
                            String path,
                            File file ); Node findOrCreateNode( Session session,
                                  String path ); Node findOrCreateNode( Session session,
                                  String path,
                                  String nodeType ); Node findOrCreateNode( Session session,
                                  String path,
                                  String defaultNodeType,
                                  String finalNodeType ); Node findOrCreateNode( Node parentNode,
                                  String path,
                                  String defaultNodeType,
                                  String finalNodeType ); Node findOrCreateChild( Node parent,
                                   String name ); Node findOrCreateChild( Node parent,
                                   String name,
                                   String nodeType ); void printSubgraph( Node node ); void printSubgraph( Node node,
                               int maxDepth ); void printNode( Node node ); void printSubgraph( Node node,
                               String lead,
                               int depthOfSubgraph,
                               int maxDepthOfSubgraph );  }### Answer:
@Test public void shouldGetNode() throws RepositoryException { Node node = tools.getNode(session.getRootNode(), "Person", true); assertNotNull(node); assertThat(node.getName(), is("Person")); assertThat(problems.size(), is(0)); }
@Test public void shouldFailGetNodeWithNoDoesntExist() { try { tools.getNode(session.getRootNode(), "Animal", true); } catch (Exception e) { assertTrue(e instanceof PathNotFoundException); } }
@Test public void shouldFailGetNodeNullParent() { try { tools.getNode(NULL_NODE, "Person", true); } catch (Exception e) { assertTrue(e instanceof IllegalArgumentException); } }
@Test public void shouldFailGetNodeNullPath() { try { tools.getNode(personNode, NULL_STRING, true); } catch (Exception e) { assertTrue(e instanceof IllegalArgumentException); } }