@SuppressWarnings("unchecked")
@Test
public void testAdminIOException() throws Exception {

  HttpURLConnection conn = EasyMock.createMock(HttpURLConnection.class);
  expect(conn.getResponseCode()).andThrow(new IOException("whoops"));
  expect(m_streamProvider.processURL((String) anyObject(), (String) anyObject(),
      (InputStream) anyObject(), (Map<String, List<String>>) anyObject())).andReturn(conn).anyTimes();
  replay(conn, m_streamProvider);
  PrerequisiteCheck check = new PrerequisiteCheck(CheckDescription.SERVICES_RANGER_PASSWORD_VERIFY, null);
  m_rpc.perform(check, new PrereqCheckRequest("cluster"));
  assertEquals(PrereqCheckStatus.WARNING, check.getStatus());
  assertEquals("Could not access Ranger to verify user 'admin' against " + RANGER_URL + "service/public/api/repository/count. whoops", check.getFailReason());
  verify(conn, m_streamProvider);
}