public Map<String, MinionEventObserver> getMinionEventObserverWithGivenState(MinionTaskState taskState) {
    return _taskEventObservers.entrySet().stream()
        .filter(e -> e.getValue().getTaskState() == taskState)
        .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
  }
@Test
  public void testGetMinionEventObserverWithGivenState() {
    MinionEventObserver observer1 = new MinionProgressObserver();
    observer1.notifyTaskStart(null);
    MinionEventObservers.getInstance().addMinionEventObserver("t01", observer1);

    MinionEventObserver observer2 = new MinionProgressObserver();
    observer2.notifyProgress(null, "");
    MinionEventObservers.getInstance().addMinionEventObserver("t02", observer2);

    MinionEventObserver observer3 = new MinionProgressObserver();
    observer3.notifyTaskSuccess(null, "");
    MinionEventObservers.getInstance().addMinionEventObserver("t03", observer3);

    Map<String, MinionEventObserver> minionEventObserverWithGivenState =
        MinionEventObservers.getInstance().getMinionEventObserverWithGivenState(MinionTaskState.IN_PROGRESS);
    assertEquals(minionEventObserverWithGivenState.size(), 2);
    assertSame(minionEventObserverWithGivenState.get("t01"), observer1);
    assertSame(minionEventObserverWithGivenState.get("t02"), observer2);
  }