View Javadoc
1   package org.codehaus.plexus.compiler;
2   
3   import java.util.Iterator;
4   import java.util.Map;
5   
6   import org.junit.jupiter.api.BeforeEach;
7   import org.junit.jupiter.api.Test;
8   
9   import static org.junit.jupiter.api.Assertions.assertEquals;
10  
11  public class CompilerConfigurationTest {
12      private CompilerConfiguration configuration;
13  
14      @BeforeEach
15      protected void setUp() throws Exception {
16          configuration = new CompilerConfiguration();
17      }
18  
19      @Test
20      public void testCustomArguments() {
21          configuration.addCompilerCustomArgument("--add-exports", "FROM-MOD/package1=OTHER-MOD");
22          configuration.addCompilerCustomArgument("--add-exports", "FROM-MOD/package2=OTHER-MOD");
23  
24          assertEquals(1, configuration.getCustomCompilerArgumentsAsMap().size());
25          assertEquals(
26                  "FROM-MOD/package2=OTHER-MOD",
27                  configuration.getCustomCompilerArgumentsAsMap().get("--add-exports"));
28  
29          assertEquals(2, configuration.getCustomCompilerArgumentsEntries().size());
30          Iterator<Map.Entry<String, String>> entries =
31                  configuration.getCustomCompilerArgumentsEntries().iterator();
32          Map.Entry<String, String> entry;
33  
34          entry = entries.next();
35          assertEquals("--add-exports", entry.getKey());
36          assertEquals("FROM-MOD/package1=OTHER-MOD", entry.getValue());
37          entry = entries.next();
38          assertEquals("--add-exports", entry.getKey());
39          assertEquals("FROM-MOD/package2=OTHER-MOD", entry.getValue());
40      }
41  }