public void testSetLoginConfigReplacing() throws Exception {
  String xml=WEBAPP_TEST_HEADER + "" + "  <login-config>"+ "    <auth-method>DIGEST</auth-method>"+ "  </login-config>"+ "</web-app>";
  WebXml webXml=WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes("UTF-8")),getEntityResolver());
  WebXmlUtils.setLoginConfig(webXml,"BASIC","Test Realm");
  assertTrue(WebXmlUtils.hasLoginConfig(webXml));
  assertEquals("BASIC",WebXmlUtils.getLoginConfigAuthMethod(webXml));
}

public void testSetLoginConfigReplacing ( ) throws Exception { String xml = WEBAPP_TEST_HEADER + "" + "  <login-config>" + "    <auth-method>DIGEST</auth-method>" + "  </login-config>" + "</web-app>" ; WebXml webXml = WebXmlIo . parseWebXml ( new ByteArrayInputStream ( xml . getBytes ( "UTF-8" ) ) , getEntityResolver ( ) ) ; WebXmlUtils . setLoginConfig ( webXml , "BASIC" , "Test Realm" ) ; assertTrue ( WebXmlUtils . hasLoginConfig ( webXml ) ) ; assertEquals ( "BASIC" , WebXmlUtils . getLoginConfigAuthMethod ( webXml ) ) ; }
tests retrieving the authentication method from a descriptor .
