@Test public void testCalculateUnitFundingSourceBadId() throws Exception { protocolFundingSourceService = new ProtocolFundingSourceServiceImpl(); protocolFundingSourceService.setUnitService(getUnitService()); protocolFundingSourceService.setFundingSourceTypeService(getFundingSourceTypeService()); ProtocolFundingSource fundingSource = (ProtocolFundingSource) protocolFundingSourceService.updateProtocolFundingSource( UNIT_SOURCE_TYPE_ID, UNIT_NUMBER_BAD, null); assertNotNull(fundingSource); assertNull(fundingSource.getFundingSourceName()); }
@Test public void testCalculateSponsorFunding() throws Exception { protocolFundingSourceService = new ProtocolFundingSourceServiceImpl(); protocolFundingSourceService.setSponsorService(getSponsorService()); protocolFundingSourceService.setFundingSourceTypeService(getFundingSourceTypeService()); ProtocolFundingSource fundingSource = (ProtocolFundingSource) protocolFundingSourceService.updateProtocolFundingSource( SPONSOR_SOURCE_TYPE_ID, SPONSOR_NUMBER_AIR_FORCE, null); assertNotNull(fundingSource); assertTrue(fundingSource.getFundingSourceName().equalsIgnoreCase(sponsorNameAirForce)); }
@Test public void testCalculateUnitFunding() throws Exception { protocolFundingSourceService = new ProtocolFundingSourceServiceImpl(); protocolFundingSourceService.setUnitService(getUnitService()); protocolFundingSourceService.setFundingSourceTypeService(getFundingSourceTypeService()); ProtocolFundingSource fundingSource = (ProtocolFundingSource) protocolFundingSourceService.updateProtocolFundingSource( UNIT_SOURCE_TYPE_ID, UNIT_NUMBER_GOOD, null); assertNotNull(fundingSource); assertNotNull(fundingSource.getFundingSourceName()); assertTrue(fundingSource.getFundingSourceName().equalsIgnoreCase(UNIT_NAME_GOOD)); }
@Test public void testCalculateOtherFunding() throws Exception { protocolFundingSourceService = new ProtocolFundingSourceServiceImpl(); protocolFundingSourceService.setFundingSourceTypeService(getFundingSourceTypeService()); ProtocolFundingSource fundingSource = (ProtocolFundingSource) protocolFundingSourceService.updateProtocolFundingSource( OTHER_SOURCE_TYPE_ID, OTHER_NUMBER_GOOD, OTHER_NAME_GOOD); assertNotNull(fundingSource); assertNotNull(fundingSource.getFundingSourceName()); assertTrue(fundingSource.getFundingSourceName().equalsIgnoreCase(OTHER_NAME_GOOD)); assertTrue(StringUtils.isEmpty(fundingSource.getFundingSourceTitle())); }
@Test public void testCalculateAwardFundingBadIdBadNumber() throws Exception { protocolFundingSourceService = new ProtocolFundingSourceServiceImpl(); protocolFundingSourceService.setAwardService(getAwardService()); protocolFundingSourceService.setFundingSourceTypeService(getFundingSourceTypeService()); protocolFundingSourceService.setParameterService(getParameterService()); ProtocolFundingSource fundingSource = (ProtocolFundingSource) protocolFundingSourceService.updateProtocolFundingSource( AWARD_SOURCE_TYPE_ID, AWARD_NUMBER_BAD, null); assertNotNull(fundingSource); assertTrue(StringUtils.isEmpty(fundingSource.getFundingSourceName())); assertTrue(StringUtils.isEmpty(fundingSource.getFundingSourceTitle())); }
@Test public void testCalculateDevProposalFundingBadID() throws Exception { protocolFundingSourceService = new ProtocolFundingSourceServiceImpl(); protocolFundingSourceService.setParameterService(getParameterService()); protocolFundingSourceService.setBusinessObjectService(getBusinessObjectService()); protocolFundingSourceService.setFundingSourceTypeService(getFundingSourceTypeService()); ProtocolFundingSource fundingSource = (ProtocolFundingSource) protocolFundingSourceService.updateProtocolFundingSource( DEVELOPMENT_PROP_SOURCE_TYPE_ID, DEV_PROPOSAL_NUMBER_BAD, null); assertNotNull(fundingSource); assertTrue(StringUtils.isEmpty(fundingSource.getFundingSourceName())); assertTrue(StringUtils.isEmpty(fundingSource.getFundingSourceTitle())); }
@Test public void testCalculateAwardFundingBadIdGoodNumber() throws Exception { protocolFundingSourceService = new ProtocolFundingSourceServiceImpl(); protocolFundingSourceService.setAwardService(getAwardService()); protocolFundingSourceService.setFundingSourceTypeService(getFundingSourceTypeService()); protocolFundingSourceService.setParameterService(getParameterService()); ProtocolFundingSource fundingSource = (ProtocolFundingSource) protocolFundingSourceService.updateProtocolFundingSource( AWARD_SOURCE_TYPE_ID, AWARD_NUMBER_GOOD, null); assertNotNull(fundingSource); assertNotNull(fundingSource.getFundingSourceName()); assertTrue(fundingSource.getFundingSourceName().equalsIgnoreCase(sponsorNameAirForce)); assertTrue(fundingSource.getFundingSourceTitle().equalsIgnoreCase(AWARD_TITLE_GOOD)); }
@Test public void testCalculateInstProposalFundingBadIdBadNumber() throws Exception { protocolFundingSourceService = new ProtocolFundingSourceServiceImpl(); protocolFundingSourceService.setParameterService(getParameterService()); protocolFundingSourceService.setInstitutionalProposalService(getInstProposalService()); protocolFundingSourceService.setFundingSourceTypeService(getFundingSourceTypeService()); protocolFundingSourceService.setBusinessObjectService(getBusinessObjectService()); ProtocolFundingSource fundingSource = (ProtocolFundingSource) protocolFundingSourceService.updateProtocolFundingSource( INSTITUTE_PROP_SOURCE_TYPE_ID, INST_PROPOSAL_NUMBER_BAD, null); assertNotNull(fundingSource); assertTrue(StringUtils.isEmpty(fundingSource.getFundingSourceName())); assertTrue(StringUtils.isEmpty(fundingSource.getFundingSourceTitle())); }
@Test public void testCalculateDevProposalFunding() throws Exception { protocolFundingSourceService = new ProtocolFundingSourceServiceImpl(); protocolFundingSourceService.setParameterService(getParameterService()); protocolFundingSourceService.setBusinessObjectService(getBusinessObjectService()); protocolFundingSourceService.setFundingSourceTypeService(getFundingSourceTypeService()); ProtocolFundingSource fundingSource = (ProtocolFundingSource) protocolFundingSourceService.updateProtocolFundingSource( DEVELOPMENT_PROP_SOURCE_TYPE_ID, DEV_PROPOSAL_NUMBER_GOOD, null); assertNotNull(fundingSource); assertNotNull(fundingSource.getFundingSourceName()); assertTrue(fundingSource.getFundingSourceName().equalsIgnoreCase(sponsorNameAirForce)); assertTrue(fundingSource.getFundingSourceTitle().equalsIgnoreCase(DEV_PROPOSAL_TITLE_GOOD)); }
@Test public void testCalculateInstProposalFundingBadIdGoodNumber() throws Exception { protocolFundingSourceService = new ProtocolFundingSourceServiceImpl(); protocolFundingSourceService.setParameterService(getParameterService()); protocolFundingSourceService.setInstitutionalProposalService(getInstProposalService()); protocolFundingSourceService.setFundingSourceTypeService(getFundingSourceTypeService()); protocolFundingSourceService.setBusinessObjectService(getBusinessObjectService()); ProtocolFundingSource fundingSource = (ProtocolFundingSource) protocolFundingSourceService.updateProtocolFundingSource( INSTITUTE_PROP_SOURCE_TYPE_ID, INST_PROPOSAL_NUMBER_GOOD, null); assertNotNull(fundingSource); assertNotNull(fundingSource.getFundingSourceName()); assertTrue(fundingSource.getFundingSourceName().equalsIgnoreCase(sponsorNameAirForce)); assertTrue(fundingSource.getFundingSourceTitle().equalsIgnoreCase(INST_PROPOSAL_TITLE_GOOD)); }