@Test public void testPopulateNotMetered() { final ConditionData source = new ConditionData(); source.setType(WRONG_TYPE); final EntitlementData result = new EntitlementData(); meteredConditionEntitlementPopulator.populate(source, result); Assert.assertNull(result.getConditionGeo()); }
@Test public void testPopulateNoProperty() { final ConditionData source = new ConditionData(); source.setType(METERED_TYPE); final EntitlementData result = new EntitlementData(); result.setUsageUnit(USAGE_UNIT_DATA); thrown.expect(ConversionException.class); thrown.expectMessage("Quantity must not be null"); meteredConditionEntitlementPopulator.populate(source, result); }
@Test public void testPopulateMetered() { final ConditionData source = new ConditionData(); source.setType(METERED_TYPE); source.setProperty(GRANT_PARAMETER_METERED, CORRECT_QUANTITY); final EntitlementData result = new EntitlementData(); result.setUsageUnit(USAGE_UNIT_DATA); meteredConditionEntitlementPopulator.populate(source, result); Assert.assertEquals(1, result.getQuantity()); }
@Test public void testPopulateWrongQuantity() { final ConditionData source = new ConditionData(); source.setType(METERED_TYPE); source.setProperty(GRANT_PARAMETER_METERED, WRONG_QUANTITY); final EntitlementData result = new EntitlementData(); result.setUsageUnit(USAGE_UNIT_DATA); thrown.expect(ConversionException.class); thrown.expectMessage("Quantity must be integer"); meteredConditionEntitlementPopulator.populate(source, result); }