GenericErrorsOutputHandler implements MavenInvocationOutputHandler<GenericErrorsOutputHandler, String> { @Override public String getResult() { if (!executionStarted) { throw new IllegalStateException("Execution has not started. No results to return."); } else { return message; } }  @Override void consumeLine(String line); @Override String getResult(); @Override GenericErrorsOutputHandler copy();  }
@Test(expectedExceptions = IllegalStateException.class) public void throwsIfNoResultsBecauseExecutionHasntStarted(){ GenericErrorsOutputHandler handler = new GenericErrorsOutputHandler(); handler.getResult(); }