public Map<String, List<JobTriggerDto>> getForJobs(Collection<String> jobDefinitionIds) {
        if (jobDefinitionIds == null) {
            throw new IllegalArgumentException("jobDefinitionIds cannot be null");
        }

        final Set<String> queryValues = jobDefinitionIds.stream()
                .filter(Objects::nonNull)
                .filter(id -> !isNullOrEmpty(id))
                .collect(Collectors.toSet());

        final var filter = in(FIELD_JOB_DEFINITION_ID, queryValues);
        final Map<String, List<JobTriggerDto>> groupedTriggers = StreamEx.of(stream(collection.find(filter)))
                .groupingBy(JobTriggerDto::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.
        for (Map.Entry<String, List<JobTriggerDto>> entry : groupedTriggers.entrySet()) {
            if (entry.getValue().size() > 1) {
                throw new IllegalStateException("More than one trigger for job definition <" + entry.getKey() + ">");
            }
        }

        return groupedTriggers;
    }
@Test
    @MongoDBFixtures("job-triggers.json")
    public void getForJobs() {
        assertThatCode(() -> dbJobTriggerService.getForJobs(null))
                .isInstanceOf(IllegalArgumentException.class)
                .hasMessageContaining("jobDefinitionId");

        assertThat(dbJobTriggerService.getForJobs(Collections.emptySet())).isEmpty();
        assertThat(dbJobTriggerService.getForJobs(Collections.singleton("doesntexist"))).isEmpty();

        assertThat(dbJobTriggerService.getForJobs(ImmutableSet.of("54e3deadbeefdeadbeefaff4", "54e3deadbeefdeadbeefaff5")))
                .hasSize(2)
                .satisfies(triggers -> {
                    assertThat(triggers.get("54e3deadbeefdeadbeefaff4")).hasSize(1);
                    assertThat(triggers.get("54e3deadbeefdeadbeefaff4").get(0)).satisfies(trigger -> {
                        assertThat(trigger.id()).isEqualTo("54e3deadbeefdeadbeef0002");
                        assertThat(trigger.jobDefinitionId()).isEqualTo("54e3deadbeefdeadbeefaff4");
                    });

                    assertThat(triggers.get("54e3deadbeefdeadbeefaff5")).hasSize(1);
                    assertThat(triggers.get("54e3deadbeefdeadbeefaff5").get(0)).satisfies(trigger -> {
                        assertThat(trigger.id()).isEqualTo("54e3deadbeefdeadbeef0003");
                        assertThat(trigger.jobDefinitionId()).isEqualTo("54e3deadbeefdeadbeefaff5");
                    });
                });

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