@SuppressWarnings("unchecked") @Test public void testExecutableForQuery() throws Exception { final String outputFilename = File.createTempFile("schemacrawler", "test").getAbsolutePath(); final Executable<DataTextFormatOptions> executable = (Executable<DataTextFormatOptions>) appContext.getBean("executableForQuery"); executable.getToolOptions().getOutputOptions().setOutputFileName(outputFilename); executeAndCheckForOutputFile(executable, outputFilename); }
private void executeAndCheckForOutputFile( final Executable<?> executable, final String outputFilename) throws Exception { executable.execute(testUtility.getDataSource()); final File outputFile = new File(outputFilename); assertTrue(outputFile.exists()); assertTrue(outputFile.length() > 0); if (!outputFile.delete()) { fail("Cannot delete output file"); } }