### Question:
AmbariServer { protected void configureHandlerCompression(ServletContextHandler context) { if (configs.isApiGzipped()) { FilterHolder gzipFilter = context.addFilter(GzipFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST)); gzipFilter.setInitParameter("methods", "GET,POST,PUT,DELETE"); gzipFilter.setInitParameter("excludePathPatterns", ".*(\\.woff|\\.ttf|\\.woff2|\\.eot|\\.svg)"); gzipFilter.setInitParameter("mimeTypes", "text/html,text/plain,text/xml,text/css,application/x-javascript," + "application/xml,application/x-www-form-urlencoded," + "application/javascript,application/json"); gzipFilter.setInitParameter("minGzipSize", configs.getApiGzipMinSize()); } }  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 testConfigureCompression() throws Exception { final ServletContextHandler handler = EasyMock.createNiceMock(ServletContextHandler.class); final FilterHolder filter = EasyMock.createNiceMock(FilterHolder.class); EasyMock.expect(handler.addFilter(GzipFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST))).andReturn(filter).once(); filter.setInitParameter(anyObject(String.class),anyObject(String.class)); EasyMock.expectLastCall().times(3); replay(handler, filter); injector.getInstance(AmbariServer.class).configureHandlerCompression(handler); EasyMock.verify(handler); }