private void checkErrorState(String errorProperty, String errorMessageKey) { MessageMap messageMap = GlobalVariables.getMessageMap(); Assert.assertTrue(messageMap.getErrorCount() >= 1); @SuppressWarnings("unchecked") List<ErrorMessage> errors = messageMap.getErrorMessagesForProperty(errorProperty); if (errors != null) { Assert.assertEquals(1, errors.size()); Assert.assertEquals(errorMessageKey, errors.get(0).getErrorKey()); } else { Assert.fail("No errors posted"); } Assert.assertFalse( "rule should return false", rule.processSaveAwardProjectPersonsBusinessRules(award.getProjectPersons())); }
@Test public void testProjectRolesChanges() { // when a coi is changed to key person coiPerson.setContactRole(ContactRoleFixtureFactory.MOCK_KEY_PERSON); Assert.assertFalse( "Key Person Role not checked for", rule.checkForKeyPersonProjectRoles(award.getProjectPersons())); coiPerson.setKeyPersonRole("fromCOI"); Assert.assertTrue( "Key Person Role not checked for", rule.checkForKeyPersonProjectRoles(award.getProjectPersons())); // when a key person is changed to coi kpPerson.setContactRole(ContactRoleFixtureFactory.MOCK_COI); Assert.assertTrue( "rule should return true", rule.processSaveAwardProjectPersonsBusinessRules(award.getProjectPersons())); }