### Question:
GraphApi { public Optional<Node> getNode(String id, Optional<String> lblHint) { String iriResolved = curieUtil.getIri(id).orElse(id); Optional<Node> node = Optional.empty(); if (lblHint.isPresent()) { Label hintLabel = Label.label(lblHint.get()); Node hit = graphDb.findNode(hintLabel, NodeProperties.IRI, iriResolved); if (hit != null) { node = Optional.of(hit); } } else { String startQuery = "MATCH (n {" + NodeProperties.IRI + ": \"" + iriResolved + "\"}) RETURN n"; Result res = cypherUtil.execute(startQuery); if (res.hasNext()) { node = Optional.of((Node) res.next().get("n")); } } return node; } @Inject  GraphApi(GraphDatabaseService graphDb, CypherUtil cypherUtil, CurieUtil curieUtil); Collection<Node> getEntailment(Node parent, DirectedRelationshipType relationship,
      boolean traverseEquivalentEdges); @AddCuries Graph getNeighbors(Set<Node> nodes, int depth, Set<DirectedRelationshipType> types,
      final Optional<Predicate<Node>> includeNode); Graph getEdges(RelationshipType type, boolean entail, long skip, long limit); Optional<Node> getNode(String id, Optional<String> lblHint); Graph getReachableNodes(Node start, List<String> rels, Set<String> lbls); Collection<RelationshipType> getAllRelationshipTypes(); Collection<String> getAllPropertyKeys();  }### Answer:
@Test public void getNode_isReturned() { Optional<String> empty = Optional.empty(); Optional<Node> node = graphApi.getNode("a", empty); assertThat(node.isPresent(), is(true)); assertThat(node.get(), is(a)); }
@Test public void getNode_nothingReturnedForFakeLabel() { Optional<Node> node = graphApi.getNode("a", Optional.of("fakeLabel")); assertThat(node.isPresent(), is(false)); }
@Test public void getNode_nodeReturnedForValidLabel() { Optional<Node> node = graphApi.getNode("a", Optional.of("alabel")); assertThat(node.isPresent(), is(true)); assertThat(node.get(), is(a)); }
@Test public void getNode_nothingReturnedForNonExisting() { Optional<String> empty = Optional.empty(); Optional<Node> node = graphApi.getNode("z", empty); assertThat(node.isPresent(), is(false)); }