private CommandJob createCommandJob(Integer id, Command<?> command, Date submitTime) { CommandJob commandJob = new CommandJob(command); commandJob.setId(id); commandJob.setOwner("someUser"); commandJob.setStatus(Status.SUCCEEDED); if (submitTime != null) { commandJob.setSubmitTime(submitTime); commandJob.run(); } return commandJob; }