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 Oct 10, 2021
1 parent 16afe06 commit 8e399f8
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.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<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 8e399f8

Please sign in to comment.