public synchronized List<SplunkEvent> getEvents() {
    return getEvents("search");
  }
@Test
  public void testGetEventsShouldThrowErrorWhenXmlReaderFailsToParseResponse() {
    Job mockJob =
        clientFactory.getServiceClient(any(ServiceArgs.class)).getJobs().create(anyString());

    when(mockJob.isDone()).thenReturn(true);
    when(mockJob.getEvents())
        .thenReturn(
            new InputStream() {
              @Override
              public int read() throws IOException {
                throw new IOException();
              }
            });

    assertThrows(SplunkResourceManagerException.class, () -> testManager.getEvents(QUERY));
  }