@Test
  public void testIsDowngradeAllowed() throws Exception {
    Map<String, UpgradePack> upgrades = ambariMetaInfo.getUpgradePacks("HDP", "2.2.0");
    assertTrue(upgrades.size() > 0);

    String upgradePackWithoutDowngrade = "upgrade_test_no_downgrade";
    boolean foundAtLeastOnePackWithoutDowngrade = false;

    for (String key : upgrades.keySet()) {
      UpgradePack upgradePack = upgrades.get(key);
      if (upgradePack.getName().equals(upgradePackWithoutDowngrade)) {
        foundAtLeastOnePackWithoutDowngrade = true;
        assertFalse(upgradePack.isDowngradeAllowed());
        continue;
      }

      assertTrue(upgradePack.isDowngradeAllowed());
    }

    assertTrue(foundAtLeastOnePackWithoutDowngrade);
  }
Tests that boolean values are property serialized in the upgrade pack.

@throws Exception
ambari-server/src/test/java/org/apache/ambari/server/state/stack/UpgradePackTest.java