### Question:
AptUtils { public static String encodeAnchor( String id ) { if ( id == null ) { return null; } id = id.trim(); int length = id.length(); StringBuilder buffer = new StringBuilder( length ); for ( int i = 0; i < length; ++i ) { char c = id.charAt( i ); if ( ( i == 0 ) && ( !Character.isLetter( c ) ) ) { buffer.append( 'a' ); } if ( c == ' ' ) { buffer.append( '_' ); } else if ( ( Character.isLetterOrDigit( c ) ) || ( c == '-' ) || ( c == '_' ) || ( c == ':' ) || ( c == '.' ) ) { buffer.append( c ); } } return buffer.toString(); } private  AptUtils(); static String encodeFragment( String text ); static boolean isExternalLink( String link ); static boolean isInternalLink( String link ); static boolean isLocalLink( String link ); static String linkToKey( String text ); static String encodeAnchor( String id );  }### Answer:
@Test public void testEncodeAnchor() { assertNull( AptUtils.encodeAnchor( null ) ); assertEquals( "a123_:_.-aBc", AptUtils.encodeAnchor( " 12!3 :_.&-a)Bc " ) ); }