@Test(expected = TTransportException.class)
  public void testInvalidJWT() throws Exception {
    String jwtToken = generateJWT(USER_1, jwtUnauthorizedKeyFile.toPath(),
        TimeUnit.MINUTES.toMillis(2));
    System.getenv().put("HMS_JWT", jwtToken);
    String dbName = ("invalid_jwt_" + TEST_DB_NAME_PREFIX + "_" + UUID.randomUUID()).toLowerCase();
    HiveMetaStoreClient client = new HiveMetaStoreClient(conf);
    try {
      Thread.sleep(TimeUnit.MILLISECONDS.toMillis(2));
      Database createdDb = new Database();
      createdDb.setName(dbName);
      client.createDatabase(createdDb);
    } catch (InterruptedException e) {
      // ignore
    } finally {
      try {
        client.close();
      } catch (Exception e) {
        LOG.error("Failed to close metastore client");
      }
    }
  }
This is a hack to make environment variables modifiable.
Ref: https://stackoverflow.com/questions/318239/how-do-i-set-environment-variables-from-java.
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestRemoteHiveMetastoreWithHttpJwt.java