@SuppressWarnings("nullness")
  public static Map<String, Object> splunkEventToMap(SplunkEvent event) {
    Map<String, Object> eventMap = new HashMap<>();
    eventMap.put(SPLUNK_EVENT_KEY, event.event());
    eventMap.put(SPLUNK_HOST_KEY, event.host());
    eventMap.put(SPLUNK_INDEX_KEY, event.index() != null ? event.index() : DEFAULT_SPLUNK_INDEX);
    eventMap.put(SPLUNK_SOURCE_KEY, event.source());
    eventMap.put(SPLUNK_SOURCE_TYPE_KEY, event.sourceType());
    eventMap.put(SPLUNK_TIME_KEY, event.time());

    return eventMap;
  }
@Test
  public void testSplunkEventToMapWithValuesSet() {
    SplunkEvent event =
        SplunkEvent.newBuilder()
            .withEvent("myEvent")
            .withSource("mySource")
            .withSourceType("mySourceType")
            .withIndex("myIndex")
            .withTime(123L)
            .create();

    Map<String, Object> expected = new HashMap<>();
    expected.put("event", "myEvent");
    expected.put("source", "mySource");
    expected.put("sourcetype", "mySourceType");
    expected.put("index", "myIndex");
    expected.put("time", 123L);
    expected.put("host", null);

    Map<String, Object> actual = splunkEventToMap(event);
    assertThat(actual).containsExactlyEntriesIn(expected);
  }