### Question:
StopMojo extends BatchEEMojoBase { @Override public void execute() throws MojoExecutionException, MojoFailureException { getOrCreateOperator().stop(executionId); getLog().info("Stopped job #" + executionId); }  @Override void execute();  }### Answer:
@Test public void stop() throws Exception { final StopMojo mojo = mojo(StopMojo.class); final long id = mojo.getOrCreateOperator().start("simple", new Properties() {{ setProperty("sleep", "5000"); }}); JobExecution jobExecution; do { jobExecution = mojo.getOrCreateOperator().getJobExecution(id); } while (!BatchStatus.STARTED.equals(jobExecution.getBatchStatus())); mojo.executionId = id; mojo.execute(); Batches.waitForEnd(id); final String output = BatchEEMojoTestFactory.output(mojo); assertEquals(BatchStatus.STOPPED, mojo.getOrCreateOperator().getJobExecution(Long.parseLong(output.substring(output.lastIndexOf("#") + 1).trim())).getBatchStatus()); assertTrue(output.toLowerCase(Locale.ENGLISH).contains("stopped")); }