void () { List<Integer> childLog = new ArrayList<>(); final String commonEquivalence = "child"; TaskWithEquivalentObject taskA = new TaskWithEquivalentObject(commonEquivalence) { @Override public void perform(@NotNull ProgressIndicator indicator) { childLog.add(1); } }; TaskWithEquivalentObject taskB = new TaskWithEquivalentObject(commonEquivalence) { @Override public void perform(@NotNull ProgressIndicator indicator) { childLog.add(-1); } }; //both taskA and taskB submits the same equality object, it must run both myQueue.addTask(taskA); myQueue.addTask(taskB); runAllTasks(); Assert.assertEquals("All tasks should run, but were: " + childLog, 2, childLog.size()); }