@Test public void testCheckForExistingPI() { Assert.assertTrue( "PI not found or more than one found", rule.checkForOnePrincipalInvestigator(award.getProjectPersons())); award.getProjectPersons().remove(0); Assert.assertFalse( "PI existence check failed", rule.checkForOnePrincipalInvestigator(award.getProjectPersons())); checkErrorState( AwardProjectPersonsSaveRule.AWARD_PROJECT_PERSON_LIST_ERROR_KEY, AwardProjectPersonsSaveRule.ERROR_AWARD_PROJECT_PERSON_NO_PI); }
@Test public void testCheckForMultiplePIs() { AwardPerson newPerson = new AwardPerson( KcPersonFixtureFactory.createKcPerson(KP_PERSON_ID), ContactRoleFixtureFactory.MOCK_PI); newPerson.setPropAwardPersonRoleService(roleService); award.add(newPerson); Assert.assertFalse( "Multiple PIs not detected", rule.checkForOnePrincipalInvestigator(award.getProjectPersons())); checkErrorState( AwardProjectPersonsSaveRule.AWARD_PROJECT_PERSON_LIST_ERROR_KEY, AwardProjectPersonsSaveRule.ERROR_AWARD_PROJECT_PERSON_MULTIPLE_PI_EXISTS); }