ValidateProjectMojo extends AbstractMojo { @Override public void execute() throws MojoExecutionException, MojoFailureException { File appDirectory = new File( this.project.getBasedir(), MavenPluginConstants.SOURCE_MODEL_DIRECTORY ); if( ! appDirectory.isDirectory()) throw new MojoFailureException( "The " + MavenPluginConstants.SOURCE_MODEL_DIRECTORY + " directory does not exist." ); }  @Override void execute();  }
@Test( expected = MojoFailureException.class ) public void testInvalidStructure() throws Exception { findMojo( "project--invalid", GOAL ).execute(); }
@Test public void testValidStructure() throws Exception { findMojo( "project--invalid-app", GOAL ).execute(); findMojo( "project--valid-with-warnings", GOAL ).execute(); findMojo( "project--valid", GOAL ).execute(); }