### Question:
ReStartMojo extends JobActionMojoBase { @Override public void execute() throws MojoExecutionException, MojoFailureException { final long restartId = getOrCreateOperator().restart(executionId, toProperties(jobParameters)); getLog().info("Restarted #" + executionId + ", new id is #" + restartId); if (wait) { waitEnd(getOrCreateOperator(), restartId); } }  @Override void execute();  }### Answer:
@Test public void restart() throws Exception { final ReStartMojo mojo = mojo(ReStartMojo.class, "executionId", "0"); final long id = mojo.getOrCreateOperator().start("simple", new Properties() {{ setProperty("fail", "true"); }}); Batches.waitForEnd(mojo.getOrCreateOperator(), id); mojo.execute(); final String output = BatchEEMojoTestFactory.output(mojo); final long restartId = Long.parseLong(output.substring(output.lastIndexOf("#") + 1).trim()); Batches.waitForEnd(restartId); assertNotNull(mojo.getOrCreateOperator().getJobExecution(restartId)); assertTrue(output.toLowerCase(Locale.ENGLISH).contains("restarted")); }