How to test MessageInput send?

Thanks Marco.

Why are you adding a listener with ComponentUtil?

Yes TimestampedSubmitEvent is a custom event that allows me to get the time that the client submitted the event, not when it was received. This is important for some business logic later on. I’ll paste it below for context.

Why are you not using MessageInput.addSubmitListener ?

I can’t remember. Will that give me the client side event submit time?

public class TimestampedSubmitEvent extends SubmitEvent {
    private final String timestamp;
    private final String timezone;
    private final LocalDateTime localDateTime;

    public TimestampedSubmitEvent(MessageInput source, boolean fromClient,
                                  @EventData("event.detail.value") String value,
                                  @EventData("new Date().toISOString()") String timestamp,
                                  @EventData("Intl.DateTimeFormat().resolvedOptions().timeZone") String timezone) {
        super(source, fromClient, value);
        this.timestamp = timestamp;
        this.timezone = timezone;
        this.localDateTime = timestamp != null ? LocalDateTime.parse(timestamp, DateTimeFormatter.ISO_DATE_TIME) : LocalDateTime.now();
    }
// getters removed
}