X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Ftest%2FConversionTest.java;h=371c05aa25060a45cbb63e727a8c76b33d126c50;hb=dabc4b957b52302c39cb6d07c6c91a1f91195d5a;hp=0eb1eb04b95eef90cbd749901d673a966bee3144;hpb=f1ce03f76073d9ba0777d0f47058d614577fbe2e;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/test/ConversionTest.java b/src/be/nikiroo/fanfix/test/ConversionTest.java index 0eb1eb0..371c05a 100644 --- a/src/be/nikiroo/fanfix/test/ConversionTest.java +++ b/src/be/nikiroo/fanfix/test/ConversionTest.java @@ -18,15 +18,20 @@ import be.nikiroo.utils.test.TestCase; import be.nikiroo.utils.test.TestLauncher; class ConversionTest extends TestLauncher { - private File testFile; - private File expectedDir; - private File resultDir; + private String testUri; + private String expectedDir; + private String resultDir; private List realTypes; private Map> skipCompare; - public ConversionTest(String[] args) { + public ConversionTest(final String testUri, final String expectedDir, + final String resultDir, String[] args) { super("Conversion", args); + this.testUri = testUri; + this.expectedDir = expectedDir; + this.resultDir = resultDir; + // Special mode SYSOUT is not a file type (System.out) realTypes = new ArrayList(); for (BasicOutput.OutputType type : BasicOutput.OutputType.values()) { @@ -38,20 +43,23 @@ class ConversionTest extends TestLauncher { addTest(new TestCase("Read the test file") { @Override public void test() throws Exception { - assertEquals("The test file \"" + testFile - + "\" cannot be found", true, testFile.exists()); + assertEquals("The test file \"" + testUri + + "\" cannot be found", true, + new File(testUri).exists()); } }); addTest(new TestCase("Assure directories exist") { @Override public void test() throws Exception { - expectedDir.mkdirs(); - resultDir.mkdirs(); + new File(expectedDir).mkdirs(); + new File(resultDir).mkdirs(); assertEquals("The Expected directory \"" + expectedDir - + "\" cannot be created", true, expectedDir.exists()); + + "\" cannot be created", true, + new File(expectedDir).exists()); assertEquals("The Result directory \"" + resultDir - + "\" cannot be created", true, resultDir.exists()); + + "\" cannot be created", true, + new File(resultDir).exists()); } }); @@ -62,10 +70,6 @@ class ConversionTest extends TestLauncher { @Override protected void start() throws Exception { - testFile = new File("test/test.story"); - expectedDir = new File("test/expected/"); - resultDir = new File("test/result/"); - skipCompare = new HashMap>(); skipCompare.put("epb.ncx", Arrays.asList(" errors = new ArrayList(); @@ -137,8 +142,8 @@ class ConversionTest extends TestLauncher { try { File target = new File(resultDir, type.toString()); - int code = Main.convert(testFile.getAbsolutePath(), - type.toString(), target.getAbsolutePath(), false, null); + int code = Main.convert(testUri, type.toString(), + target.getAbsolutePath(), false, null); String error = ""; for (String err : errors) {