@Test
  public void testParseCredentials() throws Exception {
    final MockHttpServletRequest request = new MockHttpServletRequest();
    final HttpBasicAuthenticationHandler handler = new HttpBasicAuthenticationHandler();

    Credentials credentials;

    try {
      handler.parseCredentials(request);
      fail("Should cause IllegalArgumentException");
    } catch (IllegalArgumentException iae) {
      // Expected
    }

    final String credentialString = "uid:pwd";

    request.addHeader(
        AbstractHttpAuthenticationHandler.AUTHORIZATION_HEADER,
        "Basic " + new String(Base64.encodeBase64(credentialString.getBytes())));
    credentials = handler.parseCredentials(request);
    assertFalse(credentials.isEmpty());
    assertEquals("uid", credentials.getUserName());
    assertEquals("pwd", credentials.getPassword());
  }
 @Test
 public void testGetAuthScheme() throws Exception {
   final HttpBasicAuthenticationHandler handler = new HttpBasicAuthenticationHandler();
   assertEquals(HttpServletRequest.BASIC_AUTH, handler.getAuthScheme());
 }