@Test public void defaultChangeScriptCreatorCreatesScriptWithTimestamp() throws Exception { final File newChangeScript = changeScriptCreator.createScript(); assertTrue(newChangeScript.exists()); final String newChangeScriptFileName = newChangeScript.getName(); assertTrue("file name doesnt have sql suffix", newChangeScriptFileName.endsWith(".sql")); assertTrue("file name not timestamped correctly", newChangeScriptFileName.matches("[0-9]{14}\\.sql")); }
public File createScript() throws IOException { final String newScriptFileName = getChangeScriptFileName(); final String fullScriptPath = scriptDirectory + File.separator + newScriptFileName; final File newChangeScriptFile = new File(fullScriptPath); if (newChangeScriptFile.createNewFile()) { return newChangeScriptFile; } else { throw new IOException("Unable to create new change script " + fullScriptPath); } }
ChangeScriptCreator { public File createScript() throws IOException { final String newScriptFileName = getChangeScriptFileName(); final String fullScriptPath = scriptDirectory + File.separator + newScriptFileName; final File newChangeScriptFile = new File(fullScriptPath); if (newChangeScriptFile.createNewFile()) { return newChangeScriptFile; } else { throw new IOException("Unable to create new change script " + fullScriptPath); } } }
ChangeScriptCreator { public File createScript() throws IOException { final String newScriptFileName = getChangeScriptFileName(); final String fullScriptPath = scriptDirectory + File.separator + newScriptFileName; final File newChangeScriptFile = new File(fullScriptPath); if (newChangeScriptFile.createNewFile()) { return newChangeScriptFile; } else { throw new IOException("Unable to create new change script " + fullScriptPath); } } ChangeScriptCreator(); }
ChangeScriptCreator { public File createScript() throws IOException { final String newScriptFileName = getChangeScriptFileName(); final String fullScriptPath = scriptDirectory + File.separator + newScriptFileName; final File newChangeScriptFile = new File(fullScriptPath); if (newChangeScriptFile.createNewFile()) { return newChangeScriptFile; } else { throw new IOException("Unable to create new change script " + fullScriptPath); } } ChangeScriptCreator(); File go(); File createScript(); void setScriptDescription(final String scriptDescription); void setScriptDirectory(final File scriptDirectory); static void main(String[] args); }
ChangeScriptCreator { public File createScript() throws IOException { final String newScriptFileName = getChangeScriptFileName(); final String fullScriptPath = scriptDirectory + File.separator + newScriptFileName; final File newChangeScriptFile = new File(fullScriptPath); if (newChangeScriptFile.createNewFile()) { return newChangeScriptFile; } else { throw new IOException("Unable to create new change script " + fullScriptPath); } } ChangeScriptCreator(); File go(); File createScript(); void setScriptDescription(final String scriptDescription); void setScriptDirectory(final File scriptDirectory); static void main(String[] args);  }