@Test(expected = MojoFailureException.class) public void doExecuteFailProcessIllegalArgumentException() throws MojoFailureException, MojoExecutionException, IOException { ResourcesContentProcessor resourcesContentProcessorMock = mock(ResourcesContentProcessor.class); doThrow(new IllegalArgumentException()).when(resourcesContentProcessorMock).process(any()); when(mojoMock.getResourcesContentProcessor()).thenReturn(Optional.of(resourcesContentProcessorMock)); doCallRealMethod().when(mojoMock).doExecute(); mojoMock.doExecute(); verify(mojoMock, times(1)).getResourcesContentProcessor(); }
@Override public void doExecute() throws MojoFailureException { getLog().debug("Processing sources..."); if (skipPluginCompatibilityValidation) { getLog() .warn( "Ignoring skipPluginCompatibilityValidation property as it is deprecated. Compatibility between mule-plugin versions is always done."); } MavenComponents mavenComponents = new MavenComponents() .withLog(getLog()) .withProject(project) .withOutputDirectory(outputDirectory) .withSession(session) .withSharedLibraries(sharedLibraries) .withProjectBuilder(projectBuilder) .withRepositorySystem(repositorySystem) .withLocalRepository(localRepository) .withRemoteArtifactRepositories(remoteArtifactRepositories) .withClassifier(classifier) .withAdditionalPluginDependencies(additionalPluginDependencies) .withProjectBaseFolder(projectBaseFolder); SourcesProcessor sourcesProcessor = new SourcesProcessor(mavenComponents); try { sourcesProcessor .process(prettyPrinting, lightweightPackage, useLocalRepository, testJar, outputDirectory, getProjectInformation().getBuildDirectory().resolve(META_INF.value()).resolve(MULE_ARTIFACT.value()).toFile(), empty()); } catch (Exception e) { String message = format("There was an exception while creating the repository of [%s]", project.toString()); throw new MojoFailureException(message, e); } }
ProcessSourcesMojo extends AbstractMuleMojo { @Override public void doExecute() throws MojoFailureException { getLog().debug("Processing sources..."); if (skipPluginCompatibilityValidation) { getLog() .warn( "Ignoring skipPluginCompatibilityValidation property as it is deprecated. Compatibility between mule-plugin versions is always done."); } MavenComponents mavenComponents = new MavenComponents() .withLog(getLog()) .withProject(project) .withOutputDirectory(outputDirectory) .withSession(session) .withSharedLibraries(sharedLibraries) .withProjectBuilder(projectBuilder) .withRepositorySystem(repositorySystem) .withLocalRepository(localRepository) .withRemoteArtifactRepositories(remoteArtifactRepositories) .withClassifier(classifier) .withAdditionalPluginDependencies(additionalPluginDependencies) .withProjectBaseFolder(projectBaseFolder); SourcesProcessor sourcesProcessor = new SourcesProcessor(mavenComponents); try { sourcesProcessor .process(prettyPrinting, lightweightPackage, useLocalRepository, testJar, outputDirectory, getProjectInformation().getBuildDirectory().resolve(META_INF.value()).resolve(MULE_ARTIFACT.value()).toFile(), empty()); } catch (Exception e) { String message = format("There was an exception while creating the repository of [%s]", project.toString()); throw new MojoFailureException(message, e); } } }
ProcessSourcesMojo extends AbstractMuleMojo { @Override public void doExecute() throws MojoFailureException { getLog().debug("Processing sources..."); if (skipPluginCompatibilityValidation) { getLog() .warn( "Ignoring skipPluginCompatibilityValidation property as it is deprecated. Compatibility between mule-plugin versions is always done."); } MavenComponents mavenComponents = new MavenComponents() .withLog(getLog()) .withProject(project) .withOutputDirectory(outputDirectory) .withSession(session) .withSharedLibraries(sharedLibraries) .withProjectBuilder(projectBuilder) .withRepositorySystem(repositorySystem) .withLocalRepository(localRepository) .withRemoteArtifactRepositories(remoteArtifactRepositories) .withClassifier(classifier) .withAdditionalPluginDependencies(additionalPluginDependencies) .withProjectBaseFolder(projectBaseFolder); SourcesProcessor sourcesProcessor = new SourcesProcessor(mavenComponents); try { sourcesProcessor .process(prettyPrinting, lightweightPackage, useLocalRepository, testJar, outputDirectory, getProjectInformation().getBuildDirectory().resolve(META_INF.value()).resolve(MULE_ARTIFACT.value()).toFile(), empty()); } catch (Exception e) { String message = format("There was an exception while creating the repository of [%s]", project.toString()); throw new MojoFailureException(message, e); } }  }
ProcessSourcesMojo extends AbstractMuleMojo { @Override public void doExecute() throws MojoFailureException { getLog().debug("Processing sources..."); if (skipPluginCompatibilityValidation) { getLog() .warn( "Ignoring skipPluginCompatibilityValidation property as it is deprecated. Compatibility between mule-plugin versions is always done."); } MavenComponents mavenComponents = new MavenComponents() .withLog(getLog()) .withProject(project) .withOutputDirectory(outputDirectory) .withSession(session) .withSharedLibraries(sharedLibraries) .withProjectBuilder(projectBuilder) .withRepositorySystem(repositorySystem) .withLocalRepository(localRepository) .withRemoteArtifactRepositories(remoteArtifactRepositories) .withClassifier(classifier) .withAdditionalPluginDependencies(additionalPluginDependencies) .withProjectBaseFolder(projectBaseFolder); SourcesProcessor sourcesProcessor = new SourcesProcessor(mavenComponents); try { sourcesProcessor .process(prettyPrinting, lightweightPackage, useLocalRepository, testJar, outputDirectory, getProjectInformation().getBuildDirectory().resolve(META_INF.value()).resolve(MULE_ARTIFACT.value()).toFile(), empty()); } catch (Exception e) { String message = format("There was an exception while creating the repository of [%s]", project.toString()); throw new MojoFailureException(message, e); } }  @Override void doExecute(); @Override String getPreviousRunPlaceholder(); }
ProcessSourcesMojo extends AbstractMuleMojo { @Override public void doExecute() throws MojoFailureException { getLog().debug("Processing sources..."); if (skipPluginCompatibilityValidation) { getLog() .warn( "Ignoring skipPluginCompatibilityValidation property as it is deprecated. Compatibility between mule-plugin versions is always done."); } MavenComponents mavenComponents = new MavenComponents() .withLog(getLog()) .withProject(project) .withOutputDirectory(outputDirectory) .withSession(session) .withSharedLibraries(sharedLibraries) .withProjectBuilder(projectBuilder) .withRepositorySystem(repositorySystem) .withLocalRepository(localRepository) .withRemoteArtifactRepositories(remoteArtifactRepositories) .withClassifier(classifier) .withAdditionalPluginDependencies(additionalPluginDependencies) .withProjectBaseFolder(projectBaseFolder); SourcesProcessor sourcesProcessor = new SourcesProcessor(mavenComponents); try { sourcesProcessor .process(prettyPrinting, lightweightPackage, useLocalRepository, testJar, outputDirectory, getProjectInformation().getBuildDirectory().resolve(META_INF.value()).resolve(MULE_ARTIFACT.value()).toFile(), empty()); } catch (Exception e) { String message = format("There was an exception while creating the repository of [%s]", project.toString()); throw new MojoFailureException(message, e); } }  @Override void doExecute(); @Override String getPreviousRunPlaceholder();  }