@Test public void testOutputFileValidation() { try { Cob2XsdIO cob2xsd = new Cob2XsdIO(defaultConfig); cob2xsd.checkTarget(null); fail(); } catch (Exception e) { assertEquals( "java.io.IOException: You must provide a target directory or file", e.toString()); } try { Cob2XsdIO cob2xsd = new Cob2XsdIO(defaultConfig); cob2xsd.checkTarget(new File("toto")); fail(); } catch (Exception e) { assertEquals("java.io.IOException: Target folder toto not found", e.toString()); } try { Cob2XsdIO cob2xsd = new Cob2XsdIO(defaultConfig); cob2xsd.checkTarget(new File("toto.xsd")); } catch (Exception e) { fail(e.toString()); } }
protected void checkTarget(final File target) throws IOException { if (target == null) { throw new IOException("You must provide a target directory or file"); } if (!target.exists()) { String extension = FilenameUtils.getExtension(target.getName()); if (extension.length() == 0) { throw new IOException("Target folder " + target + " not found"); } } }
Cob2XsdIO extends Cob2Xsd { protected void checkTarget(final File target) throws IOException { if (target == null) { throw new IOException("You must provide a target directory or file"); } if (!target.exists()) { String extension = FilenameUtils.getExtension(target.getName()); if (extension.length() == 0) { throw new IOException("Target folder " + target + " not found"); } } } }
Cob2XsdIO extends Cob2Xsd { protected void checkTarget(final File target) throws IOException { if (target == null) { throw new IOException("You must provide a target directory or file"); } if (!target.exists()) { String extension = FilenameUtils.getExtension(target.getName()); if (extension.length() == 0) { throw new IOException("Target folder " + target + " not found"); } } } Cob2XsdIO(final Cob2XsdConfig config); }
Cob2XsdIO extends Cob2Xsd { protected void checkTarget(final File target) throws IOException { if (target == null) { throw new IOException("You must provide a target directory or file"); } if (!target.exists()) { String extension = FilenameUtils.getExtension(target.getName()); if (extension.length() == 0) { throw new IOException("Target folder " + target + " not found"); } } } Cob2XsdIO(final Cob2XsdConfig config); File translate(final File cobolFile, final String cobolFileEncoding,
            final File target, final String targetNamespacePrefix,
            final String xsltFileName); }
Cob2XsdIO extends Cob2Xsd { protected void checkTarget(final File target) throws IOException { if (target == null) { throw new IOException("You must provide a target directory or file"); } if (!target.exists()) { String extension = FilenameUtils.getExtension(target.getName()); if (extension.length() == 0) { throw new IOException("Target folder " + target + " not found"); } } } Cob2XsdIO(final Cob2XsdConfig config); File translate(final File cobolFile, final String cobolFileEncoding,
            final File target, final String targetNamespacePrefix,
            final String xsltFileName);  }