From a527404aa28c575f9a10b17728fa74671c798f50 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Sun, 27 Mar 2011 19:48:11 -0300 Subject: [PATCH] Minor improvement ... --- .../test/freemind/ImportExportTest.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/wise-webapp/src/test/java/com/wisemapping/test/freemind/ImportExportTest.java b/wise-webapp/src/test/java/com/wisemapping/test/freemind/ImportExportTest.java index b1c68c9e..34cb5ed8 100644 --- a/wise-webapp/src/test/java/com/wisemapping/test/freemind/ImportExportTest.java +++ b/wise-webapp/src/test/java/com/wisemapping/test/freemind/ImportExportTest.java @@ -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