@Test(dataProvider = "suffixes") public void testDefault(String suffix) throws FormatException, IOException { outFile = tempDir.resolve("test" + suffix).toFile(); String[] args = {"test.fake", outFile.getAbsolutePath()}; assertConversion(args); }
public void assertConversion(String[] args) throws FormatException, IOException { try { ImageConverter.main(args); } catch (ExitException e) { outFile.deleteOnExit(); assertEquals(e.status, 0); checkImage(); } }
@Test public void testCompanion() throws FormatException, IOException { outFile = tempDir.resolve("test.ome.tiff").toFile(); File compFile = tempDir.resolve("test.companion.ome").toFile(); String[] args = { "-option", OMETiffWriter.COMPANION_KEY, compFile.getAbsolutePath(), "test.fake", outFile.getAbsolutePath() }; try { ImageConverter.main(args); } catch (ExitException e) { outFile.deleteOnExit(); compFile.deleteOnExit(); assertEquals(e.status, 0); assertTrue(compFile.exists()); checkImage(); } }
@Test(dataProvider = "suffixes") public void testOverwrite(String suffix) throws FormatException, IOException { outFile = Files.createTempFile(tempDir, "test", suffix).toFile(); String[] args = {"-overwrite", "test.fake", outFile.getAbsolutePath()}; assertConversion(args); }
@Test public void testSPWSeries() throws FormatException, IOException { outFile = tempDir.resolve("plate.ome.tiff").toFile(); String[] args = { "-series", "0", "plate&plates=1&fields=2.fake", outFile.getAbsolutePath() }; assertConversion(args); } }
@Test(dataProvider = "options") public void testOptions(String options) throws FormatException, IOException { outFile = tempDir.resolve("test.ome.tiff").toFile(); String[] optionsArgs = options.split(" "); ArrayList<String> argsList = new ArrayList<String>(); argsList.add("test&sizeZ=3&sizeC=2&sizeT=4.fake"); argsList.addAll(Arrays.asList(optionsArgs)); argsList.add(outFile.getAbsolutePath()); String [] args = new String[argsList.size()]; assertConversion(argsList.toArray(args)); }