@SmallTest
 public void testGetPendingData() {
   String data = "blob";
   try {
     emailAttribute.setPendingData(data);
     Assert.assertEquals(data, emailAttribute.getPendingData());
   } catch (Exception e) {
     Assert.fail();
   }
 }
 @SmallTest
 public void testSetPendingData() {
   try {
     emailAttribute.setPendingData("blob");
   } catch (Exception e) {
     Assert.fail();
   }
 }
  @SmallTest
  public void testEmptyEmail() {
    try {
      emailAttribute.setValue("");
      Assert.fail("Should have thrown InvalidAttributeValueException");
    } catch (InvalidAttributeValueException e) {

    }
  }
 @SmallTest
 public void testNullEmail() {
   try {
     emailAttribute.setValue(null);
     Assert.fail("Should have thrown InvalidAttributeValueException");
   } catch (InvalidAttributeValueException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
 }
  @SmallTest
  public void testSetInvalidEmailValue() {
    String incorrectEmail = "rob@";
    try {
      emailAttribute.setValue(incorrectEmail);
      Assert.fail("Should have thrown InvalidAttributeValueException");
    } catch (InvalidAttributeValueException e) {

    }
  }
 protected void setUp() throws Exception {
   mContext = getInstrumentation().getContext();
   MIDaaS.setContext(mContext);
   // set the persistence delegate to a simple list. database doesn't seem to work after deletion.
   AttributePersistenceCoordinator.setPersistenceDelegate(new MockPersistence());
   AuthenticationManager.getInstance()
       .setAccessTokenStrategy(new MockAccessTokenSuccessStrategy());
   emailAttribute = EmailAttributeFactory.createAttribute();
   emailAttribute.setValue(validEmail);
   mockFactory = new MockTransportFactory("init_email_ver_success.json");
   mockFactory.setTrasport(new MockTransport(mContext));
   ConnectionManager.setNetworkFactory(mockFactory);
   isInit = true;
 }
  private void initializeEmailVerificationSuccess() throws Exception {
    final CountDownLatch mLatch = new CountDownLatch(1);
    mockFactory.setFilename("init_email_ver_success.json");
    emailAttribute.startVerification(
        new InitializeVerificationCallback() {

          @Override
          public void onSuccess() {
            notificationSuccess = true;
            mLatch.countDown();
          }

          @Override
          public void onError(MIDaaSException exception) {
            notificationSuccess = false;
            mLatch.countDown();
          }
        });
    mLatch.await();
    Assert.assertTrue(notificationSuccess);
  }
  private void completeEmailVerificationSuccess() throws Exception {
    final CountDownLatch mLatch = new CountDownLatch(1);
    MIDaaS.setContext(mContext);
    mockFactory.setFilename("complete_email_ver_success.json");
    notificationSuccess = false;
    emailAttribute.completeVerification(
        "1234",
        new CompleteVerificationCallback() {

          @Override
          public void onSuccess() {
            notificationSuccess = true;
            mLatch.countDown();
          }

          @Override
          public void onError(MIDaaSException exception) {
            notificationSuccess = false;
            mLatch.countDown();
          }
        });
    mLatch.await();
    Assert.assertTrue(notificationSuccess);
  }
 @SmallTest
 public void testName() {
   Assert.assertEquals("email", emailAttribute.getName());
 }
 @SmallTest
 public void testLabel() {
   String label = "User's email";
   emailAttribute.setLabel(label);
   Assert.assertEquals(label, emailAttribute.getLabel());
 }