String[] names = context.getBeanNamesForType(Server.class);
assertEquals("Should have the name of a Jetty server", 1, names.length);
server = (Server) context.getBean(names[0]);
assertNotNull("Should have a Jetty Server", server);
HandlerCollection hcollection = (HandlerCollection) server.getChildHandlerByClass(HandlerCollection.class);
assertNotNull("Should have a HandlerCollection", hcollection);
assertNotNull("HandlerCollection should contain handlers", hcollection.getHandlers());
Handler[] handlers = hcollection.getHandlers();
assertEquals("Should be 3 handlers", 3,handlers.length);
assertTrue("First handler should be a ContextHandlerCollection", handlers[0] instanceof ContextHandlerCollection);
Handler[] webapps = ((ContextHandlerCollection)handlers[0]).getChildHandlers();
assertNotNull("Should be at least one webapp", webapps);
assertTrue("Should be an instance of WebAppContext", webapps[0] instanceof WebAppContext);