You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Samael Bate (JIRA)" <ji...@apache.org> on 2019/08/11 21:18:00 UTC
[jira] [Commented] (MPLUGINTESTING-63) AbstractMojoTestCase should
return correct type
[ https://issues.apache.org/jira/browse/MPLUGINTESTING-63?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16904742#comment-16904742 ]
Samael Bate commented on MPLUGINTESTING-63:
-------------------------------------------
seems we cannot get the goal name via the annotation as _Mojo_ has _RetentionPolicy.CLASS_ and is therefore not available at runtime.
> AbstractMojoTestCase should return correct type
> -----------------------------------------------
>
> Key: MPLUGINTESTING-63
> URL: https://issues.apache.org/jira/browse/MPLUGINTESTING-63
> Project: Maven Plugin Testing
> Issue Type: Improvement
> Reporter: Samael Bate
> Priority: Major
>
> the _AbstractMojoTestCase_ class has numerous methods that simply return _Mojo._ An exmaple of which would be:
> {code:java}
> protected Mojo lookupConfiguredMojo( MavenProject project, String goal )
> throws Exception
> {
> return lookupConfiguredMojo( newMavenSession( project ), newMojoExecution( goal ) );
> }{code}
>
> It would be to deprecate these methods and replace them with typed equivelant, so the aboce would become:
> {code:java}
> protected <T extends Mojo> T lookupConfiguredMojo( MavenProject project, Class<T> type ){code}
> as noted by [~rfscholte] on [github PR 8|https://github.com/apache/maven-plugin-testing/pull/8#issuecomment-520251983], the name of the goal could be obtained from the Mojo's annotation
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)