@SmallTest
 public void testIdTokenParam_password()
     throws IllegalArgumentException, ClassNotFoundException, NoSuchMethodException,
         InstantiationException, IllegalAccessException, InvocationTargetException,
         NoSuchFieldException {
   Object obj = setIdTokenFields("objectid", "upnid", "email", "subj");
   Calendar calendar = new GregorianCalendar();
   int seconds = 1000;
   ReflectionUtils.setFieldValue(obj, "mPasswordExpiration", seconds);
   ReflectionUtils.setFieldValue(
       obj, "mPasswordChangeUrl", "https://github.com/MSOpenTech/azure-activedirectory-library");
   UserInfo info =
       (UserInfo)
           ReflectionUtils.getInstance(ReflectionUtils.TEST_PACKAGE_NAME + ".UserInfo", obj);
   calendar.add(Calendar.SECOND, seconds);
   Date passwordExpiresOn = calendar.getTime();
   assertEquals("same userid", "objectid", info.getUserId());
   assertEquals("same name", "givenName", info.getGivenName());
   assertEquals("same family name", "familyName", info.getFamilyName());
   assertEquals("same idenity name", "provider", info.getIdentityProvider());
   assertEquals("check displayable", "upnid", info.getDisplayableId());
   assertEquals(
       "check expireson",
       passwordExpiresOn.getTime() / 1000,
       info.getPasswordExpiresOn().getTime() / 1000);
   assertEquals(
       "check uri",
       "https://github.com/MSOpenTech/azure-activedirectory-library",
       info.getPasswordChangeUrl().toString());
 }
  @Override
  public void addView(View child, int left, int top) {
    if (child.getParent() instanceof ViewGroup) {
      ViewGroup parent = (ViewGroup) child.getParent();
      LayoutTransition layoutTransition = null;
      if (parent.getLayoutTransition() != null) {
        layoutTransition = parent.getLayoutTransition();
        parent.setLayoutTransition(null);
      }
      parent.removeView(child);
      if (layoutTransition != null) {
        parent.setLayoutTransition(layoutTransition);
      }

      if (child.getParent() != null) {
        // LayoutTransition will cause the child to delay removal - cancel it
        ViewGroupUtils.cancelLayoutTransition(parent);
        // fail-safe if view is still attached for any reason
        if (child.getParent() != null && FIELD_VIEW_PARENT != null) {
          ReflectionUtils.setFieldValue(child, FIELD_VIEW_PARENT, null);
        }
      }
      if (child.getParent() != null) {
        return;
      }
    }
    child.setTag(R.id.overlay_layout_params_backup, child.getLayoutParams());
    addView(child, initParams(child, left, top));
    invalidate();
  }
 private Object setIdTokenFields(String objId, String upn, String email, String subject)
     throws ClassNotFoundException, NoSuchMethodException, InstantiationException,
         IllegalAccessException, InvocationTargetException, NoSuchFieldException {
   Object obj = ReflectionUtils.getInstance(ReflectionUtils.TEST_PACKAGE_NAME + ".IdToken");
   ReflectionUtils.setFieldValue(obj, "mObjectId", objId);
   ReflectionUtils.setFieldValue(obj, "mSubject", subject);
   ReflectionUtils.setFieldValue(obj, "mTenantId", "tenantid");
   ReflectionUtils.setFieldValue(obj, "mUpn", upn);
   ReflectionUtils.setFieldValue(obj, "mGivenName", "givenName");
   ReflectionUtils.setFieldValue(obj, "mFamilyName", "familyName");
   ReflectionUtils.setFieldValue(obj, "mEmail", email);
   ReflectionUtils.setFieldValue(obj, "mIdentityProvider", "provider");
   return obj;
 }