public String indexName(Record<GenericObject> record) {
        if (this.dateTimeFormatters.isEmpty()) {
            return this.indexNameFormat;
        }
        Instant eventTime = Instant.ofEpochMilli(record.getEventTime()
                .orElseThrow(() -> new IllegalStateException("No event time in record")));
        StringBuilder builder = new StringBuilder(this.segments.get(0));

        for (int i = 0; i < dateTimeFormatters.size(); i++) {
            builder.append(dateTimeFormatters.get(i).format(eventTime));
            builder.append(this.segments.get(i + 1));
        }

        return builder.toString();
    }
@Test(dataProvider = "indexFormats")
    public void testIndexFormats(String format, String result) {
        Record record = Mockito.mock(Record.class);
        when(record.getEventTime()).thenReturn(Optional.of(1645182000000L));
        IndexNameFormatter formatter = new IndexNameFormatter(format);
        assertEquals(formatter.indexName(record), result);
    }