### Question:
GraphImporter { public Graph.Batch importXml( URI uri, Location location ) throws IOException, SAXException, RepositorySourceException { return importXml(uri, location, false); } GraphImporter( Graph graph ); ExecutionContext getContext(); Graph getGraph(); Graph.Batch importXml( URI uri,
                                  Location location ); Graph.Batch importXml( URI uri,
                                  Location location,
                                  boolean skip ); Graph.Batch importXml( InputStream stream,
                                  Location location ); Graph.Batch importXml( InputStream stream,
                                  Location location,
                                  boolean skip ); XmlHandler getHandlerForImportingXml( Location location,
                                                 boolean skip );  }### Answer:
@Test public void shouldImportXmlContentAndGenerateTheCorrectCommands() throws Exception { Graph.Batch batch = importer.importXml(xmlContent, Location.create(destinationPath)); batch.execute(); assertThat(lastExecutedRequest, is(instanceOf(CompositeRequest.class))); Iterator<Request> iter = ((CompositeRequest)lastExecutedRequest).iterator(); assertCreateNode(iter, "/a/b/mode:system[1]"); assertCreateNode(iter, "/a/b/mode:system[1]/mode:sources[1]"); assertCreateNode(iter, "/a/b/mode:system[1]/mode:sources[1]/sourceA[1]", "repositoryName=repositoryA", "retryLimit=3", "jcr:primaryType={http: "mode:classname=org.modeshape.connector.inmemory.InMemoryRepositorySource"); assertCreateNode(iter, "/a/b/mode:system[1]/mode:sources[1]/sourceB[1]", "repositoryName=repositoryB", "jcr:primaryType={http: "mode:classname=org.modeshape.connector.inmemory.InMemoryRepositorySource"); assertCreateProperties(iter, "/a/b/mode:system[1]/mode:sources[1]", "jcr:primaryType={http: assertCreateProperties(iter, "/a/b/mode:system[1]", "jcr:primaryType={http: assertThat(iter.hasNext(), is(false)); }