@UsesMocks({SocializeEntityLoader.class, EntityLoaderUtils.class})
  public void testShowEntityById() {
    final Entity entity = new Entity();

    SocializeEntityUtils utils =
        new SocializeEntityUtils() {
          @Override
          public void getEntity(Activity context, long id, EntityGetListener listener) {
            listener.onGet(entity);
          }
        };

    SocializeEntityLoader entityLoader = AndroidMock.createMock(SocializeEntityLoader.class);
    EntityLoaderUtils entityLoaderUtils = AndroidMock.createMock(EntityLoaderUtils.class);

    AndroidMock.expect(entityLoaderUtils.initEntityLoader()).andReturn(entityLoader);
    AndroidMock.expect(entityLoader.canLoad(TestUtils.getActivity(this), entity)).andReturn(true);

    entityLoader.loadEntity(TestUtils.getActivity(this), entity);

    AndroidMock.replay(entityLoaderUtils, entityLoader);

    utils.setEntityLoaderUtils(entityLoaderUtils);
    utils.showEntity(TestUtils.getActivity(this), 123, null);

    AndroidMock.verify(entityLoaderUtils, entityLoader);
  }
  /* (non-Javadoc)
   * @see com.socialize.launcher.Launcher#launch(android.app.Activity, android.os.Bundle)
   */
  @Override
  public boolean launch(final Activity context, Bundle data) {

    if (entityLoaderUtils != null) {
      SocializeEntityLoader entityLoader = entityLoaderUtils.initEntityLoader();

      if (entityLoader != null) {

        Object idObj = data.get(Socialize.ENTITY_ID);

        if (idObj != null) {
          long id = Long.parseLong(idObj.toString());
          try {
            SocializeSession session = notificationAuthenticator.authenticate(context);
            Entity entity = entitySystem.getEntity(session, id);
            return loadEntity(context, entityLoader, entity);
          } catch (SocializeException e) {
            handleError("Failed to load entity", e);
          }
        } else {
          handleWarn("No entity id found.  Entity based notification cannot be handled");
        }
      } else {
        handleWarn("No entity loader found.  Entity based notification cannot be handled");
      }
    }

    return false;
  }
 protected synchronized void initEntityLoader() {
   EntityLoaderUtils entityLoaderUtils = container.getBean("entityLoaderUtils");
   entityLoaderUtils.initEntityLoader();
 }