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