### Question:
ApplicationDataStore extends CommonDatastore<ApplicationItem, Application> implements DatastoreHasAdd<ApplicationItem>,
DatastoreHasUpdate<ApplicationItem>,
DatastoreHasGet<ApplicationItem>,DatastoreHasSearch<ApplicationItem>, DatastoreHasDelete { @Override public ItemSearchResult<ApplicationItem> search(final int page, final int resultsByPage, final String search, final String orders, final Map<String, String> filters) { final SearchOptionsCreator creator = makeSearchOptionCreator(page, resultsByPage, search, orders, filters); SearchResult<Application> searchResult; try { searchResult = runSearch(creator); return new ItemSearchResult<ApplicationItem>(page, resultsByPage, searchResult.getCount(), convertEngineToConsoleItemsList(searchResult.getResult())); } catch (final SearchException e) { throw new APIException(e); } } ApplicationDataStore(final APISession engineSession, final ApplicationAPI applicationAPI, final PageAPI pageAPI, final ApplicationItemConverter converter); @Override void delete(final List<APIID> ids); @Override ApplicationItem get(final APIID id); @Override ApplicationItem add(final ApplicationItem item); @Override ApplicationItem update(final APIID id, final Map<String, String> attributes); @Override ItemSearchResult<ApplicationItem> search(final int page, final int resultsByPage, final String search, final String orders,
            final Map<String, String> filters);  }### Answer:
@Test(expected = APIException.class) public void should_throw_APIException_on_search_when_engine_throws_exception() throws Exception { given(applicationAPI.searchApplications(any(SearchOptions.class))).willThrow(new SearchException(new Exception())); final String orders = ApplicationItem.ATTRIBUTE_TOKEN + " DESC"; dataStore.search(1, 2, "search", orders, Collections.<String, String> emptyMap()); }