@Test
public void testRequestURLWithCustom() throws Exception {

  URLStreamProvider streamProvider = createNiceMock(URLStreamProvider.class);
  HttpURLConnection urlConnection = createNiceMock(HttpURLConnection.class);
  ViewContext viewContext = createNiceMock(ViewContext.class);
  String responseBody = "Response body...";
  InputStream inputStream = new ByteArrayInputStream(responseBody.getBytes(Charset.forName("UTF-8")));
  expect(streamProvider.processURL(eq("spec?impersonate=hive"), eq("requestMethod"), eq((String) null), eq((Map<String, List<String>>)null))).andReturn(urlConnection);
  expect(urlConnection.getInputStream()).andReturn(inputStream);
  replay(streamProvider, urlConnection);
  HttpImpersonatorImpl impersonator = new HttpImpersonatorImpl(viewContext, streamProvider);
  ImpersonatorSetting setting = new ImpersonatorSettingImpl("hive", "impersonate");
  Assert.assertEquals(responseBody, impersonator.requestURL("spec", "requestMethod", setting));
  verify(streamProvider, urlConnection);
}