public JobTriggerDto create(JobTriggerDto trigger) {
        requireNonNull(trigger, "trigger cannot be null");

        // Make sure we don't save triggers that have an ID. That would potentially overwrite an existing trigger
        // and destroy locks and other data.
        if (trigger.id() != null) {
            throw new IllegalArgumentException("New trigger must not have an ID");
        }

        var id = insertedIdAsString(collection.insertOne(trigger));
        return trigger.toBuilder().id(id).build();
    }
@Test
    public void createTrigger() {
        final JobTriggerDto trigger = dbJobTriggerService.create(JobTriggerDto.Builder.create(clock)
                .jobDefinitionId("abc-123")
                .jobDefinitionType("event-processor-execution-v1")
                .schedule(IntervalJobSchedule.builder()
                        .interval(1)
                        .unit(TimeUnit.SECONDS)
                        .build())
                .build());

        assertThat(trigger.id()).isNotBlank();
        assertThat(trigger.status()).isEqualTo(JobTriggerStatus.RUNNABLE);
        assertThat(trigger.lock()).isEqualTo(JobTriggerLock.empty());

        assertThatCode(() -> dbJobTriggerService.create(null))
                .isInstanceOf(NullPointerException.class)
                .hasMessageContaining("trigger cannot be null");
    }