public void deploy(Iterable<Class<?>> classes, Iterable<URL> beansXml)
     throws DeploymentException {
   this.lifecycle = newLifecycle();
   lifecycle.initialize();
   try {
     MockWebBeanDiscovery discovery = lifecycle.getWebBeanDiscovery();
     discovery.setWebBeanClasses(classes);
     if (beansXml != null) {
       discovery.setWebBeansXmlFiles(beansXml);
     }
     lifecycle.beginApplication();
   } catch (Exception e) {
     throw new DeploymentException("Error deploying beans", e);
   }
   lifecycle.beginSession();
   lifecycle.beginRequest();
 }
 public void undeploy() {
   lifecycle.endRequest();
   lifecycle.endSession();
   lifecycle.endApplication();
   lifecycle = null;
 }