SortMojo extends AbstractParentMojo { protected void sortPom() throws MojoFailureException { new ExceptionConverter(sortPomImpl::sortPom).executeAndConvertException(); }  void setup();  }
@Test void thrownExceptionShouldBeConvertedToMojoException() { doThrow(new FailureException("Gurka")).when(sortPom).sortPom(); final Executable testMethod = () -> sortMojo.execute(); final MojoFailureException thrown = assertThrows(MojoFailureException.class, testMethod); assertThat("Unexpected message", thrown.getMessage(), is(equalTo("Gurka"))); }