### Question:
MavenCli { static ProfileActivation determineProfileActivation( final CommandLine commandLine ) { final ProfileActivation result = new ProfileActivation(); if ( commandLine.hasOption( CLIManager.ACTIVATE_PROFILES ) ) { String[] profileOptionValues = commandLine.getOptionValues( CLIManager.ACTIVATE_PROFILES ); if ( profileOptionValues != null ) { for ( String profileOptionValue : profileOptionValues ) { StringTokenizer profileTokens = new StringTokenizer( profileOptionValue, "," ); while ( profileTokens.hasMoreTokens() ) { String profileAction = profileTokens.nextToken().trim(); if ( profileAction.startsWith( "-" ) || profileAction.startsWith( "!" ) ) { result.deactivate( profileAction.substring( 1 ) ); } else if ( profileAction.startsWith( "+" ) ) { result.activate( profileAction.substring( 1 ) ); } else { result.activate( profileAction ); } } } } } return result; } MavenCli();  MavenCli( ClassWorld classWorld ); static void main( String[] args ); static int main( String[] args, ClassWorld classWorld ); static int doMain( String[] args, ClassWorld classWorld ); int doMain( String[] args, String workingDirectory, PrintStream stdout, PrintStream stderr ); int doMain( CliRequest cliRequest ); static final String LOCAL_REPO_PROPERTY; static final String MULTIMODULE_PROJECT_DIRECTORY; static final String USER_HOME; static final File USER_MAVEN_CONFIGURATION_HOME; static final File DEFAULT_USER_TOOLCHAINS_FILE; static final File DEFAULT_GLOBAL_TOOLCHAINS_FILE; static final String STYLE_COLOR_PROPERTY; }### Answer:
@Test public void testDetermineProfileActivation() throws ParseException { MavenCli.ProfileActivation result; Options options = new Options(); options.addOption( Option.builder( Character.toString( CLIManager.ACTIVATE_PROFILES ) ).hasArg().build() ); result = determineProfileActivation( new GnuParser().parse( options, new String[]{ "-P", "test1,+test2" } ) ); assertThat( result.activeProfiles.size(), is( 2 ) ); assertThat( result.activeProfiles, contains( "test1", "test2" ) ); result = determineProfileActivation( new GnuParser().parse( options, new String[]{ "-P", "!test1,-test2" } ) ); assertThat( result.inactiveProfiles.size(), is( 2 ) ); assertThat( result.inactiveProfiles, contains( "test1", "test2" ) ); result = determineProfileActivation( new GnuParser().parse( options, new String[]{ "-P", "-test1,+test2" } ) ); assertThat( result.activeProfiles.size(), is( 1 ) ); assertThat( result.activeProfiles, contains( "test2" ) ); assertThat( result.inactiveProfiles.size(), is( 1 ) ); assertThat( result.inactiveProfiles, contains( "test1" ) ); }