public synchronized List<SplunkEvent> getEvents() {
    return getEvents("search");
  }
@Test
  public void testGetEventsShouldReturnTrueIfSplunkDoesNotThrowAnyError() {
    Job mockJob =
        clientFactory.getServiceClient(any(ServiceArgs.class)).getJobs().create(anyString());
    String rawEvent =
        "<results preview='0'>"
            + "<meta><fieldOrder>"
            + "<field>_raw</field><field>_sourcetype</field><field>_time</field>"
            + "<field>host</field><field>index</field><field>source</field>"
            + "</fieldOrder></meta>"
            + "<result offset='0'>"
            + "<field k='_raw'><v xml:space='preserve' trunc='0'>myEvent</v></field>"
            + "<field k='_sourcetype'><value><text>mySourceType</text></value></field>"
            + "<field k='_time'><value><text>1970-01-01T00:00:00.123+00:00</text></value></field>"
            + "<field k='host'><value><text>myHost</text></value></field>"
            + "<field k='index'><value><text>myIndex</text></value></field>"
            + "<field k='source'><value><text>mySource</text></value></field>"
            + "</result></results>";
    InputStream inputStream = new ByteArrayInputStream(rawEvent.getBytes(StandardCharsets.UTF_8));
    SplunkEvent splunkEvent =
        SplunkEvent.newBuilder()
            .withEvent("myEvent")
            .withHost("myHost")
            .withSource("mySource")
            .withSourceType("mySourceType")
            .withIndex("myIndex")
            .withTime(123L)
            .create();

    when(mockJob.isDone()).thenReturn(true);
    when(mockJob.getEvents()).thenReturn(inputStream);

    assertThat(testManager.getEvents())
        .containsExactlyElementsIn(Collections.singletonList(splunkEvent));
  }