Skip to content

Commit

Permalink
[MNG-6776] Inconsistent list of parameters for MojoDescriptor (testcase)
Browse files Browse the repository at this point in the history
  • Loading branch information
slachiewicz committed Dec 26, 2019
1 parent e3aa406 commit 54abc10
Showing 1 changed file with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package org.apache.maven.plugin.descriptor;

import org.junit.Test;

import java.util.List;
import java.util.Map;

import static org.junit.Assert.*;

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<Parameter> parameters = mojoDescriptor.getParameters();
assertEquals( 1, parameters.size() );

Map<String, Parameter> 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() );
}

}

0 comments on commit 54abc10

Please sign in to comment.