### Question:
RoleDatastore extends CommonDatastore<RoleItem, Role> implements
        DatastoreHasGet<RoleItem>,
        DatastoreHasSearch<RoleItem>,
        DatastoreHasAdd<RoleItem>,
        DatastoreHasUpdate<RoleItem>,
        DatastoreHasDelete { @Override public RoleItem get(final APIID id) { try { return convertEngineToConsoleItem(getIdentityAPI().getRole(id.toLong())); } catch (final Exception e) { throw new APIException(e); } } RoleDatastore(final APISession engineSession); @Override void delete(final List<APIID> ids); @Override RoleItem update(final APIID id, final Map<String, String> attributes); @Override RoleItem add(final RoleItem role); @Override ItemSearchResult<RoleItem> search(final int page, final int resultsByPage, final String search, final String orders,
            final Map<String, String> filters); @Override RoleItem get(final APIID id); Long getNumberOfUsers(final APIID roleId);  }### Answer:
@Test public void should_get_retrieve_role_with_icon() throws Exception { RoleImpl myRole = new RoleImpl(12L, "myRole"); myRole.setIconId(2134L); doReturn(myRole).when(identityAPI).getRole(12L); RoleItem roleItem = roleDatastore.get(APIID.makeAPIID(12L)); assertThat(roleItem.getIcon()).isEqualTo("../API/avatars/2134"); }
@Test public void should_get_retrieve_role_without_icon() throws Exception { RoleImpl myRole = new RoleImpl(12L, "myRole"); doReturn(myRole).when(identityAPI).getRole(12L); RoleItem roleItem = roleDatastore.get(APIID.makeAPIID(12L)); assertThat(roleItem.getIcon()).isEmpty(); }
@Test public void should_retrieve_role_from_engine() throws Exception { doReturn(new RoleImpl(123, "myRole")).when(identityAPI).getRole(123L); RoleItem roleItem = roleDatastore.get(APIID.makeAPIID(123L)); assertThat(roleItem.getName()).isEqualTo("myRole"); }