@Test public void yields_document_when_import_in_same_directory() throws Exception { Node root = resolver.resolveImports( "changelog/changelog-same-level-import.xml", changelogLoader ); assertThat(contents(root)).isXmlEqualTo( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<changelog>\n" + " <changeset author=\"fbiville\" id=\"first-changelog\">\n" + " <query><![CDATA[MATCH (n) RETURN n]]></query>\n" + " </changeset>\n" + " <changeset author=\"team\" id=\"second-changelog\">\n" + " <query><![CDATA[MATCH (m) RETURN m]]></query>\n" + " </changeset>\n" + "</changelog>"); }
public Node resolveImports(String changelog, ChangelogLoader changelogLoader) { try (InputStream stream = changelogLoader.load(changelog)) { if (stream == null) { throw new RuntimeException("Import location cannot be resolved: " + changelog); } return resolve(changelog, document(stream), changelogLoader); } catch (IOException e) { throw propagate(e); } }
ImportResolver { public Node resolveImports(String changelog, ChangelogLoader changelogLoader) { try (InputStream stream = changelogLoader.load(changelog)) { if (stream == null) { throw new RuntimeException("Import location cannot be resolved: " + changelog); } return resolve(changelog, document(stream), changelogLoader); } catch (IOException e) { throw propagate(e); } } }
ImportResolver { public Node resolveImports(String changelog, ChangelogLoader changelogLoader) { try (InputStream stream = changelogLoader.load(changelog)) { if (stream == null) { throw new RuntimeException("Import location cannot be resolved: " + changelog); } return resolve(changelog, document(stream), changelogLoader); } catch (IOException e) { throw propagate(e); } } ImportResolver(); }
ImportResolver { public Node resolveImports(String changelog, ChangelogLoader changelogLoader) { try (InputStream stream = changelogLoader.load(changelog)) { if (stream == null) { throw new RuntimeException("Import location cannot be resolved: " + changelog); } return resolve(changelog, document(stream), changelogLoader); } catch (IOException e) { throw propagate(e); } } ImportResolver(); Node resolveImports(String changelog, ChangelogLoader changelogLoader); }
ImportResolver { public Node resolveImports(String changelog, ChangelogLoader changelogLoader) { try (InputStream stream = changelogLoader.load(changelog)) { if (stream == null) { throw new RuntimeException("Import location cannot be resolved: " + changelog); } return resolve(changelog, document(stream), changelogLoader); } catch (IOException e) { throw propagate(e); } } ImportResolver(); Node resolveImports(String changelog, ChangelogLoader changelogLoader);  }