@Test
public void testUrlDecoder() {

    // Normal cases
    assertEquals("  ", resilientUrlDecode("  "));
    assertEquals("  ", resilientUrlDecode(" %20"));
    assertEquals("  ", resilientUrlDecode("%20 "));
    assertEquals("  ", resilientUrlDecode("%20%20"));
    assertEquals("  ", resilientUrlDecode("%u0020%u0020"));
    assertEquals("  ", resilientUrlDecode("%20%u0020"));
    assertEquals("  ", resilientUrlDecode("%u0020%20"));
    // Deformed characters at the end of the line (desired is they are discarded)
    assertEquals("x ", resilientUrlDecode("x %2"));
    assertEquals("x ", resilientUrlDecode("x%20%2"));
    assertEquals("x 2", resilientUrlDecode("x%u202"));
    assertEquals("x ", resilientUrlDecode("x%u20"));
    assertEquals("x", resilientUrlDecode("x%u2"));
    assertEquals("x", resilientUrlDecode("x%u"));
    assertEquals("x", resilientUrlDecode("x%"));
    // Combined test case (7 spaces and a chopped one)
    assertEquals("       ", resilientUrlDecode("%20 %20%u0020%20 %20%2"));
}