@Test
public void testHandle() throws Exception {

  final WebAppContext handler = createNiceMock(WebAppContext.class);
  ViewRegistry viewRegistry = createNiceMock(ViewRegistry.class);
  ViewEntity viewEntity = createNiceMock(ViewEntity.class);
  ClassLoader classLoader = createNiceMock(ClassLoader.class);
  Request baseRequest = createNiceMock(Request.class);
  HttpServletRequest request = createNiceMock(HttpServletRequest.class);
  HttpServletResponse response = createNiceMock(HttpServletResponse.class);
  expect(viewRegistry.getDefinition("TEST", "1.0.0")).andReturn(viewEntity).anyTimes();
  expect(viewEntity.getClassLoader()).andReturn(classLoader).anyTimes();
  expect(handler.isStarted()).andReturn(true).anyTimes();
  replay(handler, viewRegistry, viewEntity);
  handler.handle("/api/v1/views/TEST/versions/1.0.0/instances/INSTANCE_1/resources/test",
      baseRequest, request, response);
  AmbariHandlerList handlerList = getAmbariHandlerList(handler);
  handlerList.viewRegistry = viewRegistry;
  handlerList.start();
  handlerList.addHandler(handler);
  handlerList.handle("/api/v1/views/TEST/versions/1.0.0/instances/INSTANCE_1/resources/test",
      baseRequest, request, response);
  verify(handler, viewRegistry, viewEntity);
}