@Before
  public void setUp() {
    this.userId = new MyIdentity(IdentityType.CSS, "xcmanager", "societies.local");
    CtxEntityIdentifier ctxId = new CtxEntityIdentifier(userId.getJid(), "Person", new Long(1));
    this.userCtxEntity = new CtxEntity(ctxId);
    hasPrivacyPreferences =
        new CtxAssociation(
            new CtxAssociationIdentifier(
                userId.getJid(), CtxTypes.HAS_PRIVACY_PREFERENCES, new Long(3)));
    CtxEntityIdentifier preferenceEntityId_ppnp1 =
        new CtxEntityIdentifier(userId.getJid(), CtxTypes.PRIVACY_PREFERENCE, new Long(2));
    this.privacyPreferenceEntity = new CtxEntity(preferenceEntityId_ppnp1);
    this.ppnp_1_CtxAttribute =
        new CtxAttribute(
            new CtxAttributeIdentifier(
                this.privacyPreferenceEntity.getId(), "ppnp_preference_1", new Long(5)));
    this.registryCtxAttribute =
        new CtxAttribute(
            new CtxAttributeIdentifier(
                userCtxEntity.getId(), CtxTypes.PRIVACY_PREFERENCE_REGISTRY, new Long(1)));
    Mockito.when(commsManager.getIdManager()).thenReturn(identityManager);
    privPrefMgr.setCtxBroker(ctxBroker);
    privPrefMgr.setCommsMgr(commsManager);
    privPrefMgr.setprivacyDataManagerInternal(privacyDataManager);
    privPrefMgr.setTrustBroker(trustBroker);
    privPrefMgr.setMyMessageBox(myMsgBox);

    try {
      Mockito.when(ctxBroker.lookup(CtxModelType.ATTRIBUTE, CtxTypes.PRIVACY_PREFERENCE_REGISTRY))
          .thenReturn(new AsyncResult<List<CtxIdentifier>>(new ArrayList<CtxIdentifier>()));
      Mockito.when(ctxBroker.lookup(CtxModelType.ENTITY, CtxTypes.PRIVACY_PREFERENCE))
          .thenReturn(new AsyncResult<List<CtxIdentifier>>(new ArrayList<CtxIdentifier>()));
      Mockito.when(ctxBroker.lookup(CtxModelType.ASSOCIATION, CtxTypes.HAS_PRIVACY_PREFERENCES))
          .thenReturn(new AsyncResult<List<CtxIdentifier>>(new ArrayList<CtxIdentifier>()));
      IndividualCtxEntity weirdPerson = new IndividualCtxEntity(userCtxEntity.getId());
      Mockito.when(ctxBroker.retrieveCssOperator())
          .thenReturn(new AsyncResult<IndividualCtxEntity>(weirdPerson));

      Mockito.when(ctxBroker.createAssociation(CtxTypes.HAS_PRIVACY_PREFERENCES))
          .thenReturn(new AsyncResult<CtxAssociation>(this.hasPrivacyPreferences));
      Mockito.when(ctxBroker.createEntity(CtxTypes.PRIVACY_PREFERENCE))
          .thenReturn(new AsyncResult<CtxEntity>(privacyPreferenceEntity));
      Mockito.when(ctxBroker.createAttribute(privacyPreferenceEntity.getId(), "ppnp_preference_1"))
          .thenReturn(new AsyncResult<CtxAttribute>(ppnp_1_CtxAttribute));
      Mockito.when(
              ctxBroker.createAttribute(
                  userCtxEntity.getId(), CtxTypes.PRIVACY_PREFERENCE_REGISTRY))
          .thenReturn(new AsyncResult<CtxAttribute>(registryCtxAttribute));

      Mockito.when(
              myMsgBox.showConfirmDialog(
                  Mockito.anyString(), Mockito.anyString(), Mockito.eq(JOptionPane.YES_NO_OPTION)))
          .thenReturn(JOptionPane.YES_OPTION);
      Mockito.when(
              ctxBroker.updateAttribute(
                  Mockito.eq(ppnp_1_CtxAttribute.getId()), (Serializable) Mockito.anyObject()))
          .thenReturn(new AsyncResult<CtxAttribute>(ppnp_1_CtxAttribute));

    } catch (CtxException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    privPrefMgr.initialisePrivacyPreferenceManager();
  }