### Question:
SuffixState implements State { public String getSuffixStrip() { return suffixStrip; } SuffixState( final Properties userProps ); void initialise( Properties userProps ); @Override boolean isEnabled(); String getSuffixStrip();  }### Answer:
@Test public void testDefaultSuffix() { Properties props = new Properties(); props.setProperty( SuffixState.SUFFIX_STRIP_PROPERTY, "" ); SuffixState s = new SuffixState( props ); Pattern p = Pattern.compile( s.getSuffixStrip() ); Matcher m = p.matcher( "1.0.jbossorg-101909" ); assertTrue( m.matches() ); assertEquals( "1.0", m.group( 1 ) ); assertEquals( ".jbossorg-101909", m.group( 2 ) ); m = p.matcher( "1.0.Final-jbossorg-1" ); assertTrue( m.matches() ); assertEquals( "1.0.Final", m.group( 1 ) ); assertEquals( "-jbossorg-1", m.group( 2 ) ); }
@Test public void testCustomSuffix() { Properties props = new Properties(); props.setProperty( SuffixState.SUFFIX_STRIP_PROPERTY, "(.*)(.MYSUFFIX)$" ); SuffixState s = new SuffixState( props ); Pattern p = Pattern.compile( s.getSuffixStrip() ); Matcher m = p.matcher( "1.0.jbossorg-101909" ); assertFalse( m.matches() ); m = p.matcher( "1.0.MYSUFFIX" ); assertTrue( m.matches() ); assertEquals( "1.0", m.group( 1 ) ); assertEquals( ".MYSUFFIX", m.group( 2 ) ); }