コード例 #1
0
 @SmallTest
 public void testGetPendingData() {
   String data = "blob";
   try {
     emailAttribute.setPendingData(data);
     Assert.assertEquals(data, emailAttribute.getPendingData());
   } catch (Exception e) {
     Assert.fail();
   }
 }
コード例 #2
0
 @SmallTest
 public void testSetPendingData() {
   try {
     emailAttribute.setPendingData("blob");
   } catch (Exception e) {
     Assert.fail();
   }
 }
コード例 #3
0
  @SmallTest
  public void testEmptyEmail() {
    try {
      emailAttribute.setValue("");
      Assert.fail("Should have thrown InvalidAttributeValueException");
    } catch (InvalidAttributeValueException e) {

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

    }
  }
コード例 #6
0
 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;
 }
コード例 #7
0
  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);
  }
コード例 #8
0
  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);
  }
コード例 #9
0
 @SmallTest
 public void testName() {
   Assert.assertEquals("email", emailAttribute.getName());
 }
コード例 #10
0
 @SmallTest
 public void testLabel() {
   String label = "User's email";
   emailAttribute.setLabel(label);
   Assert.assertEquals(label, emailAttribute.getLabel());
 }