@Test public void testRemoveForQuantity() throws Exception { ResValue value1 = new ResValue("value1", null, Quantity.MANY); ResValue value2 = new ResValue("value2", "Comment", Quantity.FEW); resItem.addValue(value1); resItem.addValue(value2); assertEquals(value1, resItem.removeValueForQuantity(value1.quantity)); assertEquals(1, resItem.values.size()); assertNull(resItem.valueForQuantity(value1.quantity)); assertEquals(value2, resItem.valueForQuantity(value2.quantity)); assertEquals(value2, resItem.values.get(0)); assertNull(resItem.removeValueForQuantity(value1.quantity)); assertEquals(1, resItem.values.size()); assertEquals(value2, resItem.valueForQuantity(value2.quantity)); assertEquals(value2, resItem.values.get(0)); }
@Test public void testIsHasQuantities() throws Exception { assert !resItem.isHasQuantities(); resItem.addValue(new ResValue("Value1", null, Quantity.OTHER)); assert !resItem.isHasQuantities(); resItem.addValue(new ResValue("Value1", null, Quantity.MANY)); assert resItem.isHasQuantities(); resItem.removeValueForQuantity(Quantity.OTHER); assert resItem.isHasQuantities(); resItem.removeValueForQuantity(Quantity.MANY); assert !resItem.isHasQuantities(); }