From 8e399f8d8071213b93249ddfdf6701392a467bb1 Mon Sep 17 00:00:00 2001 From: Sylwester Lachiewicz Date: Sun, 6 Oct 2019 15:35:21 +0200 Subject: [PATCH] [MNG-6776] Inconsistent list of parameters for MojoDescriptor (testcase) --- .../plugin/descriptor/MojoDescriptorTest.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 maven-plugin-api/src/test/java/org/apache/maven/plugin/descriptor/MojoDescriptorTest.java diff --git a/maven-plugin-api/src/test/java/org/apache/maven/plugin/descriptor/MojoDescriptorTest.java b/maven-plugin-api/src/test/java/org/apache/maven/plugin/descriptor/MojoDescriptorTest.java new file mode 100644 index 000000000000..b76ed46824d7 --- /dev/null +++ b/maven-plugin-api/src/test/java/org/apache/maven/plugin/descriptor/MojoDescriptorTest.java @@ -0,0 +1,36 @@ +package org.apache.maven.plugin.descriptor; + +import org.junit.jupiter.api.Test; + +import java.util.List; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class MojoDescriptorTest +{ + @Test + public void getParameterMap() throws DuplicateParameterException + { + MojoDescriptor mojoDescriptor = new MojoDescriptor(); + Parameter param1 = new Parameter(); + param1.setName( "param1" ); + param1.setDefaultValue( "value1" ); + mojoDescriptor.addParameter( param1 ); + + List parameters = mojoDescriptor.getParameters(); + assertEquals( 1, parameters.size() ); + + Map parameterMap = mojoDescriptor.getParameterMap(); + assertEquals( parameters.size(), parameterMap.size() ); + + Parameter param2 = new Parameter(); + param2.setName( "param2" ); + param2.setDefaultValue( "value2" ); + mojoDescriptor.addParameter( param2 ); + + assertEquals( 2, parameters.size() ); + assertEquals( parameters.size(), parameterMap.size() ); + } + +} \ No newline at end of file