mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-12-22 19:33:48 +01:00
Minor improvement ...
This commit is contained in:
parent
cff3d7cc8a
commit
a527404aa2
@ -17,16 +17,23 @@ import java.io.*;
|
||||
@Test
|
||||
public class ImportExportTest {
|
||||
private static final String DATA_DIR_PATH = "src/test/data/freemind/";
|
||||
final private Importer importer;
|
||||
final private FreemindExporter exporter;
|
||||
|
||||
public ImportExportTest() throws ImporterException {
|
||||
ImporterFactory exporterFactory = ImporterFactory.getInstance();
|
||||
importer = exporterFactory.getImporter(ImportFormat.FREEMIND);
|
||||
exporter = new FreemindExporter();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test(dataProvider = "Data-Provider-Function")
|
||||
public void exportImportExportTest(@NotNull final File freeMindFile, @NotNull final File recFile) throws ImporterException, IOException, ExportException {
|
||||
|
||||
ImporterFactory instance = ImporterFactory.getInstance();
|
||||
Importer importer = instance.getImporter(ImportFormat.FREEMIND);
|
||||
|
||||
FileInputStream fileInputStream = new FileInputStream(freeMindFile.getAbsolutePath());
|
||||
final MindMap mindMap = importer.importMap("basic", "basic", fileInputStream);
|
||||
final FreemindExporter freemindExporter = new FreemindExporter();
|
||||
|
||||
if (recFile.exists()) {
|
||||
// Compare rec and file ...
|
||||
@ -48,18 +55,17 @@ public class ImportExportTest {
|
||||
|
||||
// Export mile content ...
|
||||
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
freemindExporter.export(mindMap, bos);
|
||||
exporter.export(mindMap, bos);
|
||||
final String exportContent = new String(bos.toByteArray());
|
||||
|
||||
Assert.assertEquals(recContent.toString(), exportContent);
|
||||
|
||||
} else {
|
||||
final FileOutputStream fos = new FileOutputStream(recFile);
|
||||
freemindExporter.export(mindMap, fos);
|
||||
exporter.export(mindMap, fos);
|
||||
fos.close();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//This function will provide the parameter data
|
||||
|
Loading…
Reference in New Issue
Block a user