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