public Optional<JobTriggerDto> getOneForJob(String jobDefinitionId) {
        final List<JobTriggerDto> triggers = getAllForJob(jobDefinitionId);
        // We are currently expecting only one trigger per job definition. This will most probably change in the
        // future once we extend our scheduler usage.
        // TODO: Don't throw exception when there is more than one trigger for a job definition.
        //       To be able to do this, we need some kind of label system to make sure we can differentiate between
        //       automatically created triggers (e.g. by event definition) and manually created ones.
        if (triggers.size() > 1) {
            throw new IllegalStateException("More than one trigger for job definition <" + jobDefinitionId + ">");
        }
        return triggers.stream().findFirst();
    }
@Test
    @MongoDBFixtures("job-triggers.json")
    public void getForJob() {
        assertThatCode(() -> dbJobTriggerService.getOneForJob(null))
                .isInstanceOf(IllegalArgumentException.class)
                .hasMessageContaining("jobDefinitionId");

        assertThatCode(() -> dbJobTriggerService.getOneForJob(""))
                .isInstanceOf(IllegalArgumentException.class)
                .hasMessageContaining("jobDefinitionId");


        assertThat(dbJobTriggerService.getOneForJob("54e3deadbeefdeadbeefaff4")).isPresent()
                .hasValueSatisfying(trigger -> {
                    assertThat(trigger.id()).isEqualTo("54e3deadbeefdeadbeef0002");
                    assertThat(trigger.jobDefinitionId()).isEqualTo("54e3deadbeefdeadbeefaff4");
                });

        assertThat(dbJobTriggerService.getOneForJob("doesntexist")).isEmpty();

        // We expect a ISE when there is more than one trigger for a single job definition
        assertThatCode(() -> dbJobTriggerService.getOneForJob("54e3deadbeefdeadbeefaff3"))
                .isInstanceOf(IllegalStateException.class)
                .hasMessageContaining("54e3deadbeefdeadbeefaff3");
    }