### Question:
DefaultUrlNormalizer implements UrlNormalizer { @Override public String normalize( String url ) { String result = url; if ( result != null ) { while ( true ) { int idx = result.indexOf( "/../" ); if ( idx < 0 ) { break; } else if ( idx == 0 ) { result = result.substring( 3 ); continue; } int parent = idx - 1; while ( parent >= 0 && result.charAt( parent ) == '/' ) { parent--; } parent = result.lastIndexOf( '/', parent ); if ( parent < 0 ) { result = result.substring( idx + 4 ); } else { result = result.substring( 0, parent ) + result.substring( idx + 3 ); } } } return result; }  @Override String normalize( String url );  }### Answer:
@Test public void testNullSafe() { assertNull( normalize( null ) ); }
@Test public void testTrailingSlash() { assertEquals( "", normalize( "" ) ); assertEquals( "http: assertEquals( "http: }
@Test public void testRemovalOfParentRefs() { assertEquals( "http: assertEquals( "http: assertEquals( "http: assertEquals( "http: }
@Test public void testPreservationOfDoubleSlashes() { assertEquals( "scm:hg:ssh: assertEquals( "file: assertEquals( "[fetch=]http: normalize( "[fetch=]http: }
@Test public void absolutePathTraversalPastRootIsOmitted() { assertEquals( "/", normalize("/../" ) ); }
@Test public void parentDirectoryRemovedFromRelativeUriReference() { assertEquals( "", normalize( "a/../" ) ); }
@Test public void leadingParentDirectoryNotRemovedFromRelativeUriReference() { assertEquals( "../", normalize( "../" ) ); }