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

        final var filter = and(
                // Make sure that the owner still owns the trigger
                eq(FIELD_LOCK_OWNER, nodeId),
                idEq(getId(trigger))
        );
        final var update = combine(
                unset(FIELD_LOCK_OWNER),
                set(FIELD_STATUS, JobTriggerStatus.ERROR));

        return collection.updateOne(filter, update).getModifiedCount() > 0;
    }
@Test
    public void setTriggerError() {
        final JobTriggerDto trigger1 = dbJobTriggerService.create(JobTriggerDto.Builder.create(clock)
                .jobDefinitionId("abc-123")
                .jobDefinitionType("event-processor-execution-v1")
                .schedule(IntervalJobSchedule.builder()
                        .interval(1)
                        .unit(TimeUnit.SECONDS)
                        .build())
                .build());

        // Lock the trigger
        assertThat(dbJobTriggerService.nextRunnableTrigger())
                .isNotEmpty()
                .get()
                .satisfies(trigger -> assertThat(trigger.id()).isEqualTo(trigger1.id()));

        assertThat(dbJobTriggerService.setTriggerError(trigger1)).isTrue();

        assertThat(dbJobTriggerService.get(trigger1.id()))
                .isPresent()
                .get()
                .satisfies(trigger -> {
                    // Make sure the lock is gone
                    assertThat(trigger.lock().owner()).isNull();
                    assertThat(trigger.status()).isEqualTo(JobTriggerStatus.ERROR);
                });

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