### Question:
DefaultNode implements ConnectedNode { @Override public GraphName resolveName(GraphName name) { return resolver.resolve(name); } DefaultNode(NodeConfiguration nodeConfiguration, Collection<NodeListener> nodeListeners,
      ScheduledExecutorService scheduledExecutorService); @Override Publisher<T> newPublisher(GraphName topicName, String messageType); @Override Publisher<T> newPublisher(String topicName, String messageType); @Override Subscriber<T> newSubscriber(GraphName topicName, String messageType); @Override Subscriber<T> newSubscriber(String topicName, String messageType); @Override ServiceServer<T, S> newServiceServer(GraphName serviceName, String serviceType,
      ServiceResponseBuilder<T, S> responseBuilder); @Override ServiceServer<T, S> newServiceServer(String serviceName, String serviceType,
      ServiceResponseBuilder<T, S> responseBuilder); @SuppressWarnings("unchecked") @Override ServiceServer<T, S> getServiceServer(GraphName serviceName); @Override ServiceServer<T, S> getServiceServer(String serviceName); @Override URI lookupServiceUri(GraphName serviceName); @Override URI lookupServiceUri(String serviceName); @Override ServiceClient<T, S> newServiceClient(GraphName serviceName, String serviceType); @Override ServiceClient<T, S> newServiceClient(String serviceName, String serviceType); @Override Time getCurrentTime(); @Override GraphName getName(); @Override Log getLog(); @Override GraphName resolveName(GraphName name); @Override GraphName resolveName(String name); @Override void shutdown(); @Override URI getMasterUri(); @Override NodeNameResolver getResolver(); @Override ParameterTree getParameterTree(); @Override URI getUri(); @Override MessageSerializationFactory getMessageSerializationFactory(); @Override MessageFactory getTopicMessageFactory(); @Override MessageFactory getServiceRequestMessageFactory(); @Override MessageFactory getServiceResponseMessageFactory(); @Override void addListener(NodeListener listener); @Override ScheduledExecutorService getScheduledExecutorService(); @Override void executeCancellableLoop(final CancellableLoop cancellableLoop);  }### Answer:
@Test public void testResolveName() throws InterruptedException { final Holder<ConnectedNode> holder = Holder.newEmpty(); nodeConfiguration.setParentResolver(NameResolver.newFromNamespace("/ns1")); nodeMainExecutor.execute(new AbstractNodeMain() { @Override public GraphName getDefaultNodeName() { return GraphName.of("test_resolver"); } @Override public void onStart(ConnectedNode connectedNode) { holder.set(connectedNode); } }, nodeConfiguration); assertTrue(holder.await(1, TimeUnit.SECONDS)); ConnectedNode connectedNode = holder.get(); assertGraphNameEquals("/foo", connectedNode.resolveName("/foo")); assertGraphNameEquals("/ns1/foo", connectedNode.resolveName("foo")); assertGraphNameEquals("/ns1/test_resolver/foo", connectedNode.resolveName("~foo")); Publisher<std_msgs.Int64> pub = connectedNode.newPublisher("pub", std_msgs.Int64._TYPE); assertGraphNameEquals("/ns1/pub", pub.getTopicName()); pub = connectedNode.newPublisher("/pub", std_msgs.Int64._TYPE); assertGraphNameEquals("/pub", pub.getTopicName()); pub = connectedNode.newPublisher("~pub", std_msgs.Int64._TYPE); assertGraphNameEquals("/ns1/test_resolver/pub", pub.getTopicName()); Subscriber<std_msgs.Int64> sub = connectedNode.newSubscriber("sub", std_msgs.Int64._TYPE); assertGraphNameEquals("/ns1/sub", sub.getTopicName()); sub = connectedNode.newSubscriber("/sub", std_msgs.Int64._TYPE); assertGraphNameEquals("/sub", sub.getTopicName()); sub = connectedNode.newSubscriber("~sub", std_msgs.Int64._TYPE); assertGraphNameEquals("/ns1/test_resolver/sub", sub.getTopicName()); }