class DbDeployCommandLineParser {

	public void parse(String[] args, DbDeploy dbDeploy) throws UsageException {
		try {
			dbDeploy.setScriptdirectory(new File("."));
            final CommandLine commandLine = new GnuParser().parse(getOptions(), args);
			copyValuesFromCommandLineToDbDeployBean(dbDeploy, commandLine);

            if (commandLine.hasOption("password") && commandLine.getOptionValue("password") == null) {
                dbDeploy.setPassword(userInputReader.read("Password"));
            }
		} catch (ParseException e) {
			throw new UsageException(e.getMessage(), e);
		}
	}

}

class DbDeployCommandLineParserTest {

     UserInputReader userInputReader;
    private final DbDeploy dbDeploy;
    private final DbDeployCommandLineParser parser;

    @Test
    public void shouldNotPromptForPasswordNotSpecifiedOnCommandLine() throws Exception {

        // this is important: not all databases require passwords :)
        parser.parse(new String[] {}, dbDeploy);
        verifyZeroInteractions(userInputReader);
    }

}