### Question:
Selector { public int getSelection( InvokerProperties invokerProperties ) { if ( !invokerProperties.isSelectorDefined( 1 ) ) { return getGlobal( invokerProperties ); } for ( int selectorIndex = 1;; selectorIndex++ ) { if ( selectorIndex > 1 && !invokerProperties.isSelectorDefined( selectorIndex ) ) { break; } int selection = 0; if ( !SelectorUtils.isMavenVersion( invokerProperties.getMavenVersion( selectorIndex ), actualMavenVersion ) ) { selection |= SELECTOR_MAVENVERSION; } if ( !SelectorUtils.isJreVersion( invokerProperties.getJreVersion( selectorIndex ), actualJavaVersion ) ) { selection |= SELECTOR_JREVERSION; } if ( !SelectorUtils.isOsFamily( invokerProperties.getOsFamily( selectorIndex ) ) ) { selection |= SELECTOR_OSFAMILY; } if ( selection == 0 ) { return 0; } } return SELECTOR_MULTI; } Selector( String actualMavenVersion, String actualJavaVersion ); int getSelection( InvokerProperties invokerProperties );  }### Answer:
@Test public void testGlobalMatch() { Selector selector = new Selector( "3.2.5", "1.7" ); Properties props = new Properties(); props.setProperty( "invoker.maven.version", "3.0+" ); InvokerProperties invokerProperties = new InvokerProperties( props ); assertEquals( 0, selector.getSelection( invokerProperties ) ); }
@Test public void testSelectorMatch() { Selector selector = new Selector( "3.2.5", "1.7" ); Properties props = new Properties(); props.setProperty( "selector.1.maven.version", "3.0+" ); InvokerProperties invokerProperties = new InvokerProperties( props ); assertEquals( 0, selector.getSelection( invokerProperties ) ); props.setProperty( "selector.1.maven.version", "3.3.1+" ); assertEquals( Selector.SELECTOR_MULTI, selector.getSelection( invokerProperties ) ); }
@Test public void testSelectorWithGlobalMatch() { Selector selector = new Selector( "3.2.5", "1.7" ); Properties props = new Properties(); props.setProperty( "invoker.maven.version", "3.0+" ); props.setProperty( "selector.1.java.version", "1.4+" ); props.setProperty( "selector.2.os.family", "myos" ); InvokerProperties invokerProperties = new InvokerProperties( props ); assertEquals( 0, selector.getSelection( invokerProperties ) ); props.setProperty( "invoker.maven.version", "3.3.1+" ); assertEquals( Selector.SELECTOR_MULTI, selector.getSelection( invokerProperties ) ); props.setProperty( "invoker.maven.version", "3.0+" ); props.setProperty( "selector.1.maven.version", "3.3.1+" ); assertEquals( Selector.SELECTOR_MULTI, selector.getSelection( invokerProperties ) ); props.setProperty( "selector.2.os.family", "!myos" ); assertEquals( 0, selector.getSelection( invokerProperties ) ); }