### Question:
AmbariServer { protected void configureRootHandler(ServletContextHandler root) { configureHandlerCompression(root); configureAdditionalContentTypes(root); root.setContextPath(CONTEXT_PATH); root.setErrorHandler(injector.getInstance(AmbariErrorHandler.class)); root.setMaxFormContentSize(-1); root.setResourceBase(configs.getWebAppDir()); }  String getServerOsType(); static AmbariManagementController getController(); static void setController(AmbariManagementController controller); @SuppressWarnings("deprecation") void run(); void stop(); @Deprecated void performStaticInjection(); void initViewRegistry(); static void setupProxyAuth(); static void enableLog4jMonitor(Map<String, String> configsMap); static void main(String[] args); static final String VIEWS_URL_PATTERN; static final EnumSet<DispatcherType> DISPATCHER_TYPES; volatile boolean running; }### Answer:
@Test public void testConfigureRootHandler() throws Exception { final ServletContextHandler handler = EasyMock.createNiceMock(ServletContextHandler.class); final FilterHolder filter = EasyMock.createNiceMock(FilterHolder.class); handler.setMaxFormContentSize(-1); EasyMock.expectLastCall().once(); EasyMock.expect(handler.addFilter(GzipFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST))).andReturn(filter).once(); EasyMock.expect(handler.getMimeTypes()).andReturn(new MimeTypes()).anyTimes(); replay(handler, filter); injector.getInstance(AmbariServer.class).configureRootHandler(handler); EasyMock.verify(handler); }
@Test public void testConfigureContentTypes() throws Exception { ServletContextHandler handler = EasyMock.createNiceMock(ServletContextHandler.class); FilterHolder filter = EasyMock.createNiceMock(FilterHolder.class); MimeTypes expectedMimeTypes = new MimeTypes(); EasyMock.expect(handler.getMimeTypes()).andReturn(expectedMimeTypes).anyTimes(); EasyMock.expect(handler.addFilter(isA(Class.class), anyString(), isA(EnumSet.class))).andReturn(filter).anyTimes(); replay(handler, filter); injector.getInstance(AmbariServer.class).configureRootHandler(handler); assertEquals("application/font-woff", expectedMimeTypes.getMimeByExtension("/file.woff").toString()); assertEquals("application/font-sfnt", expectedMimeTypes.getMimeByExtension("/file.ttf").toString()); EasyMock.verify(handler); }