### Question:
ApplicationMenuDataStore extends CommonDatastore<ApplicationMenuItem, ApplicationMenu> implements DatastoreHasAdd<ApplicationMenuItem>,
DatastoreHasUpdate<ApplicationMenuItem>,
DatastoreHasGet<ApplicationMenuItem>, DatastoreHasSearch<ApplicationMenuItem>, DatastoreHasDelete { @Override public ApplicationMenuItem add(final ApplicationMenuItem item) { try { final ApplicationMenu applicationMenu = applicationAPI.createApplicationMenu(converter.toApplicationMenuCreator(item)); return converter.toApplicationMenuItem(applicationMenu); } catch (final Exception e) { throw new APIException(e); } } ApplicationMenuDataStore(final APISession engineSession, final ApplicationAPI applicationAPI, final ApplicationMenuItemConverter converter); @Override ApplicationMenuItem add(final ApplicationMenuItem item); @Override ApplicationMenuItem update(final APIID id, final Map<String, String> attributes); @Override ApplicationMenuItem get(final APIID id); @Override void delete(final List<APIID> ids); @Override ItemSearchResult<ApplicationMenuItem> 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 ApplicationMenuItem itemToCreate = new ApplicationMenuItem(); final ApplicationMenuImpl applicationMenu = new ApplicationMenuImpl("firstMenu", 11L, 14L, 1); given(applicationAPI.createApplicationMenu(any(ApplicationMenuCreator.class))).willReturn(applicationMenu); given(converter.toApplicationMenuItem(applicationMenu)).willReturn(new ApplicationMenuItem()); final ApplicationMenuItem createdItem = dataStore.add(itemToCreate); assertThat(createdItem).isEqualTo(itemToCreate); }
@Test(expected = APIException.class) public void should_throw_APIException_when_engine_throws_CreationException_on_add() throws Exception { given(applicationAPI.createApplicationMenu(any(ApplicationMenuCreator.class))).willThrow(new CreationException("")); dataStore.add(new ApplicationMenuItem()); }