|
29 | 29 | import java.net.URISyntaxException;
|
30 | 30 | import java.util.List;
|
31 | 31 |
|
| 32 | +import org.apache.maven.plugin.descriptor.DuplicateParameterException; |
32 | 33 | import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
33 | 34 | import org.apache.maven.plugin.descriptor.Parameter;
|
34 | 35 | import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
35 | 36 | import org.apache.maven.plugin.descriptor.PluginDescriptorBuilder;
|
36 | 37 | import org.apache.maven.tools.plugin.javadoc.JavadocLinkGenerator;
|
37 | 38 | import org.codehaus.plexus.component.repository.ComponentDependency;
|
| 39 | +import org.codehaus.plexus.configuration.PlexusConfiguration; |
38 | 40 | import org.codehaus.plexus.testing.PlexusTest;
|
39 | 41 | import org.codehaus.plexus.util.ReaderFactory;
|
40 | 42 | import org.junit.jupiter.api.Test;
|
|
50 | 52 | public class PluginDescriptorFilesGeneratorTest
|
51 | 53 | extends AbstractGeneratorTestCase
|
52 | 54 | {
|
| 55 | + @Override |
| 56 | + protected void extendPluginDescriptor( PluginDescriptor pluginDescriptor ) throws DuplicateParameterException |
| 57 | + { |
| 58 | + Parameter parameterWithGenerics = new Parameter(); |
| 59 | + parameterWithGenerics.setName( "parameterWithGenerics" ); |
| 60 | + parameterWithGenerics.setType("java.util.Collection<java.lang.String>"); |
| 61 | + parameterWithGenerics.setExpression( "${customParam}" ); |
| 62 | + parameterWithGenerics.setDefaultValue( "a,b,c" ); |
| 63 | + pluginDescriptor.getMojos().get( 0 ).addParameter( parameterWithGenerics ); |
| 64 | + } |
| 65 | + |
53 | 66 | @Override
|
54 | 67 | protected void validate( File destinationDirectory )
|
55 | 68 | throws Exception
|
@@ -113,8 +126,21 @@ private void checkMojo( MojoDescriptor mojoDescriptor )
|
113 | 126 |
|
114 | 127 | assertNotNull( mojoDescriptor.isDependencyResolutionRequired() );
|
115 | 128 |
|
116 |
| - // check the parameter. |
| 129 | + // check the default parameter |
117 | 130 | checkParameter( mojoDescriptor.getParameters().get( 0 ) );
|
| 131 | + |
| 132 | + // check another parameter with generics type information |
| 133 | + Parameter parameterWithGenerics = mojoDescriptor.getParameters().get( 2 ); |
| 134 | + assertNotNull( parameterWithGenerics ); |
| 135 | + assertEquals( "parameterWithGenerics", parameterWithGenerics.getName() ); |
| 136 | + assertEquals( "java.util.Collection", parameterWithGenerics.getType() ); |
| 137 | + |
| 138 | + PlexusConfiguration configurations = mojoDescriptor.getMojoConfiguration(); |
| 139 | + assertNotNull( configurations ); |
| 140 | + PlexusConfiguration configuration = configurations.getChild( "parameterWithGenerics" ); |
| 141 | + assertEquals( "java.util.Collection", configuration.getAttribute( "implementation" ) ); |
| 142 | + assertEquals( "a,b,c", configuration.getAttribute( "default-value") ); |
| 143 | + assertEquals( "${customParam}", configuration.getValue() ); |
118 | 144 | }
|
119 | 145 |
|
120 | 146 | private void checkParameter( Parameter parameter )
|
|
0 commit comments