### Question:
ApplicationPageDataStore extends CommonDatastore<ApplicationPageItem, ApplicationPage> implements DatastoreHasAdd<ApplicationPageItem>,
DatastoreHasGet<ApplicationPageItem>, DatastoreHasSearch<ApplicationPageItem>, DatastoreHasDelete { @Override public ApplicationPageItem add(final ApplicationPageItem item) { try { final ApplicationPage applicationPage = applicationAPI.createApplicationPage(item.getApplicationId().toLong(), item.getPageId().toLong(), item.getToken()); return converter.toApplicationPageItem(applicationPage); } catch (final Exception e) { throw new APIException(e); } } ApplicationPageDataStore(final APISession engineSession, final ApplicationAPI applicationAPI, final PageAPI pageAPI,
            final ApplicationPageItemConverter converter); @Override ApplicationPageItem add(final ApplicationPageItem item); @Override ApplicationPageItem get(final APIID id); @Override void delete(final List<APIID> ids); @Override ItemSearchResult<ApplicationPageItem> search(final int page, final int resultsByPage, final String search, final String orders,
            final Map<String, String> filters);  }### Answer:
@Test public void should_return_result_of_engine_call_converted_to_item_on_add() throws Exception { final ApplicationPageItem itemToCreate = new ApplicationPageItem(); itemToCreate.setToken("firstPage"); itemToCreate.setApplicationId(14L); itemToCreate.setPageId(28L); final ApplicationPageImpl applicationPage = new ApplicationPageImpl(14L, 28L, "firstPage"); given(applicationAPI.createApplicationPage(14L, 28L, "firstPage")).willReturn(applicationPage); final ApplicationPageItem createdItem = dataStore.add(itemToCreate); assertThat(createdItem).isEqualTo(createdItem); }
@Test(expected = APIException.class) public void should_throw_APIException_when_engine_throws_CreationException_on_add() throws Exception { given(applicationAPI.createApplicationPage(anyLong(), anyLong(), anyString())).willThrow(new CreationException("")); dataStore.add(new ApplicationPageItem()); }