@SmallTest
  public void testIdTokenParam_upn()
      throws IllegalArgumentException, ClassNotFoundException, NoSuchMethodException,
          InstantiationException, IllegalAccessException, InvocationTargetException,
          NoSuchFieldException {
    Object obj = setIdTokenFields("objectid", "upnid", "email", "subj");
    UserInfo info =
        (UserInfo)
            ReflectionUtils.getInstance(ReflectionUtils.TEST_PACKAGE_NAME + ".UserInfo", obj);
    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());

    obj = setIdTokenFields("", "upnid", "email", "subj");
    info =
        (UserInfo)
            ReflectionUtils.getInstance(ReflectionUtils.TEST_PACKAGE_NAME + ".UserInfo", obj);
    assertEquals("same userid", "subj", 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());

    obj = setIdTokenFields("", "upnid", "email", "");
    info =
        (UserInfo)
            ReflectionUtils.getInstance(ReflectionUtils.TEST_PACKAGE_NAME + ".UserInfo", obj);
    assertNull("null userid", 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());

    obj = setIdTokenFields("", "", "email", "");
    info =
        (UserInfo)
            ReflectionUtils.getInstance(ReflectionUtils.TEST_PACKAGE_NAME + ".UserInfo", obj);
    assertNull("null userid", 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", "email", info.getDisplayableId());

    obj = setIdTokenFields("", "", "", "");
    info =
        (UserInfo)
            ReflectionUtils.getInstance(ReflectionUtils.TEST_PACKAGE_NAME + ".UserInfo", obj);

    assertNull("null userid", info.getUserId());
    assertNull("check displayable", info.getDisplayableId());
    assertEquals("same name", "givenName", info.getGivenName());
    assertEquals("same family name", "familyName", info.getFamilyName());
    assertEquals("same idenity name", "provider", info.getIdentityProvider());
  }
 @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());
 }
 @SmallTest
 public void testUserInfo() {
   UserInfo user = new UserInfo("userid", "givenName", "familyName", "identity", "userid");
   assertEquals("same userid", "userid", user.getUserId());
   assertEquals("same name", "givenName", user.getGivenName());
   assertEquals("same family name", "familyName", user.getFamilyName());
   assertEquals("same idenity name", "identity", user.getIdentityProvider());
   assertEquals("same flag", "userid", user.getDisplayableId());
 }