### Question:
AbstractHumanTaskDatastore extends AbstractTaskDatastore<CONSOLE_ITEM, ENGINE_ITEM> { @Override protected SearchResult<ENGINE_ITEM> runSearch(final SearchOptionsBuilder builder, final Map<String, String> filters) { try { APIID id = null; id = APIID.makeAPIID(filters.get(HumanTaskItem.FILTER_SUPERVISOR_ID)); if (id != null) { filters.remove(HumanTaskItem.FILTER_SUPERVISOR_ID); return runSupervisorSearch(filters, builder, id.toLong()); } id = APIID.makeAPIID(filters.get(HumanTaskItem.FILTER_TEAM_MANAGER_ID)); if (id != null) { return runTeamManagerSearch(filters, builder, id.toLong()); } return runGenericSearch(builder, filters); } catch (final Exception e) { throw new APIException(e); } } AbstractHumanTaskDatastore(final APISession engineSession); @Override CONSOLE_ITEM get(final APIID id); @Override CONSOLE_ITEM update(final APIID id, final Map<String, String> attributes); Long getNumberOfOpenTasks(final APIID userId); Long getNumberOfOverdueOpenTasks(final APIID userId);  }### Answer:
@Test public void should_use_searchAssignedAndPendingHumanTasks_when_filtering_ready_state() throws SearchException { datastore.runSearch(new SearchOptionsBuilder(1, 100), Collections.singletonMap("state", "ready")); verify(processAPI).searchAssignedAndPendingHumanTasks(any()); }
@Test public void should_use_searchHumanTaskInstances_when_there_is_no_particular_filter() throws SearchException { datastore.runSearch(new SearchOptionsBuilder(1, 100), Collections.singletonMap("tpye", "toto")); verify(processAPI).searchHumanTaskInstances(any()); }