use of org.xmlunit.builder.Input.Builder in project jabref by JabRef.
the class BibTeXMLExporterTestFiles method testPerformExport.
@Test
public final void testPerformExport() throws IOException, SaveException {
String xmlFileName = filename.replace(".bib", ".xml");
Path importFile = resourceDir.resolve(filename);
String tempFilename = tempFile.getCanonicalPath();
List<BibEntry> entries = testImporter.importDatabase(importFile, StandardCharsets.UTF_8).getDatabase().getEntries();
bibtexmlExportFormat.performExport(databaseContext, tempFile.getPath(), charset, entries);
Builder control = Input.from(Files.newInputStream(resourceDir.resolve(xmlFileName)));
Builder test = Input.from(Files.newInputStream(Paths.get(tempFilename)));
Assert.assertThat(test, CompareMatcher.isSimilarTo(control).withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byNameAndText)).throwComparisonFailure());
}
use of org.xmlunit.builder.Input.Builder in project jabref by JabRef.
the class MSBibExportFormatTestFiles method testPerformExport.
@Test
public final void testPerformExport() throws IOException, SaveException {
String xmlFileName = filename.replace(".bib", ".xml");
Path importFile = resourceDir.resolve(filename);
String tempFilename = tempFile.getCanonicalPath();
List<BibEntry> entries = testImporter.importDatabase(importFile, StandardCharsets.UTF_8).getDatabase().getEntries();
msBibExportFormat.performExport(databaseContext, tempFile.getPath(), charset, entries);
Builder control = Input.from(Files.newInputStream(resourceDir.resolve(xmlFileName)));
Builder test = Input.from(Files.newInputStream(Paths.get(tempFilename)));
assertThat(test, CompareMatcher.isSimilarTo(control).withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byNameAndText)).throwComparisonFailure());
}
use of org.xmlunit.builder.Input.Builder in project jabref by JabRef.
the class ModsExportFormatTestFiles method testImportAsModsAndExportAsMods.
@Test
public final void testImportAsModsAndExportAsMods() throws Exception {
String xmlFileName = filename.replace(".bib", ".xml");
String tempFilename = tempFile.getCanonicalPath();
Path xmlFile = Paths.get(ModsExportFormatTestFiles.class.getResource(xmlFileName).toURI());
List<BibEntry> entries = modsImporter.importDatabase(xmlFile, charset).getDatabase().getEntries();
modsExportFormat.performExport(databaseContext, tempFile.getPath(), charset, entries);
Builder control = Input.from(Files.newInputStream(xmlFile));
Builder test = Input.from(Files.newInputStream(Paths.get(tempFilename)));
Assert.assertThat(test, CompareMatcher.isSimilarTo(control).withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byNameAndText)).throwComparisonFailure());
}
use of org.xmlunit.builder.Input.Builder in project jabref by JabRef.
the class ModsExportFormatTestFiles method testPerformExport.
@Test
public final void testPerformExport() throws Exception {
String xmlFileName = filename.replace(".bib", ".xml");
String tempFilename = tempFile.getCanonicalPath();
List<BibEntry> entries = bibtexImporter.importDatabase(importFile, charset).getDatabase().getEntries();
Path xmlFile = Paths.get(ModsExportFormatTestFiles.class.getResource(xmlFileName).toURI());
modsExportFormat.performExport(databaseContext, tempFile.getPath(), charset, entries);
Builder control = Input.from(Files.newInputStream(xmlFile));
Builder test = Input.from(Files.newInputStream(Paths.get(tempFilename)));
Assert.assertThat(test, CompareMatcher.isSimilarTo(control).withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byNameAndText)).throwComparisonFailure());
}
Aggregations