private void addApprovedEquipmentToAward( AwardApprovedEquipment equipmentItem1, AwardApprovedEquipment equipmentItem2) { equipmentItem1.setApprovedEquipmentId(1L); award.add(equipmentItem1); equipmentItem2.setApprovedEquipmentId(2L); award.add(equipmentItem2); }
@Test public void testValidatingAmount() { AwardApprovedEquipment equipmentItem = createEquipmentItem(VENDOR, MODEL, WIDGET1, -1.00); checkValidAmount(equipmentItem, 1); equipmentItem.setAmount(0.00); checkValidAmount(equipmentItem, 1); equipmentItem.setAmount(AMOUNT2 - ONE_PENNY); checkValidAmount(equipmentItem, 1); equipmentItem.setAmount(AMOUNT2); checkValidAmount(equipmentItem, 1); equipmentItem.setAmount(null); checkValidAmount(equipmentItem, 1); }
@Test public void testRequiredFieldPresent() { AwardApprovedEquipment equipmentItem = createEquipmentItem(VENDOR, MODEL, WIDGET1, AMOUNT1); Assert.assertTrue(approvedEquipmentRule.areRequiredFieldsComplete(equipmentItem)); equipmentItem.setVendor(null); Assert.assertTrue(approvedEquipmentRule.areRequiredFieldsComplete(equipmentItem)); equipmentItem.setModel(null); Assert.assertTrue(approvedEquipmentRule.areRequiredFieldsComplete(equipmentItem)); equipmentItem.setItem(null); Assert.assertFalse(approvedEquipmentRule.areRequiredFieldsComplete(equipmentItem)); equipmentItem.setItem(WIDGET1); equipmentItem.setAmount(null); Assert.assertFalse(approvedEquipmentRule.areRequiredFieldsComplete(equipmentItem)); }
private void checkEditingItemResultingInDuplicate(AwardApprovedEquipment equipmentItem2) { equipmentItem2.setItem(WIDGET1); Assert.assertFalse( approvedEquipmentRule.isUnique(award.getApprovedEquipmentItems(), equipmentItem2)); }