StringUtil { public static void main( final String[] args ) { String[] testStrings = { "../bart/maggie.xml", "/bart/..", "/bart/../maggie/homer.xml", ".. "/bart "\\bart\\..\\maggie\\homer.xml", "I am clean", "/go/not/parent.xml", "\\go\\not\\parent.xml", "..", "should/not..not/match", "..should/not/match.xml", "should/not..", "..." }; for ( String testString : testStrings ) { boolean matches = StringUtil.doesPathContainParentPathSegment( testString ); if ( matches ) { System.out.println( testString + " matches." ); } else { System.out.println( "--------" + testString + " DOES NOT MATCH." ); } } } private  StringUtil(); static String[] tokenStringToArray( final String tokenizedString, final String token ); static boolean doesPathContainParentPathSegment( final String path ); static void main( final String[] args ); static boolean isEmpty( final String str ); static String getMapAsPrettyString( final Map map ); static Map<String, String> trimStringMap( Map<String, String> map ); static List<String> trimStringList( List<String> list ); static String trimToEmpty( String string );  }
@Test public void testMain() { try { StringUtil.main( null ); Assert.assertTrue( true ); } catch ( final Exception e ) { Assert.fail( "Exception occured: " + e ); } }