### Question:
UrlEncoder implements TextEncoder, TextDecoder { public UrlEncoder setSlashEncoded( boolean slashEncoded ) { this.slashEncoded = slashEncoded; return this; }  String encode( String text ); String decode( String encodedText ); boolean isSlashEncoded(); UrlEncoder setSlashEncoded( boolean slashEncoded ); static final char ESCAPE_CHARACTER; }### Answer:
@Test public void shouldNotEncodeForwardSlashByDefault() { checkEncoding("/", "%2f"); this.encoder.setSlashEncoded(false); checkForNoEncoding("/"); }
@Test public void shouldEncodePercent() { checkEncoding("%", "%25"); this.encoder.setSlashEncoded(false); checkEncoding("%", "%25"); }
@Test public void shouldNotEncodeAlphabeticCharacters() { checkForNoEncoding("abcdefghijklmnopqrstuvwxyz"); checkForNoEncoding("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); this.encoder.setSlashEncoded(false); checkForNoEncoding("abcdefghijklmnopqrstuvwxyz"); checkForNoEncoding("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); }
@Test public void shouldNotEncodeNumericCharacters() { checkForNoEncoding("0123456789"); this.encoder.setSlashEncoded(false); checkForNoEncoding("0123456789"); }
@Test public void shouldNotEncodeReservedPunctuationCharacters() { checkForNoEncoding("-_.!~*\'()"); this.encoder.setSlashEncoded(false); checkForNoEncoding("-_.!~*\'()"); }
@Test public void shouldEncodeAndDecodeUrlsCorrectly() { this.encoder.setSlashEncoded(false); checkEncoding("http: }