@Test public void testCalculateSponsorFundingSourceEmptyId() throws Exception { protocolFundingSourceService = new ProtocolFundingSourceServiceImpl(); protocolFundingSourceService.setSponsorService(getSponsorService()); protocolFundingSourceService.setFundingSourceTypeService(getFundingSourceTypeService()); ProtocolFundingSource fundingSource = (ProtocolFundingSource) protocolFundingSourceService.updateProtocolFundingSource( SPONSOR_SOURCE_TYPE_ID, EMPTY_NUMBER, null); assertNull(fundingSource); }
@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 testIsValidIdForTypeSponsor() throws Exception { protocolFundingSourceService = new ProtocolFundingSourceServiceImpl(); protocolFundingSourceService.setFundingSourceTypeService(getFundingSourceTypeService()); protocolFundingSourceService.setSponsorService(getSponsorService()); ProtocolFundingSource fundingSource = new ProtocolFundingSource(SPONSOR_NUMBER_AIR_FORCE, FundingSourceType.SPONSOR, null, null); assertTrue(protocolFundingSourceService.isValidIdForType(fundingSource)); fundingSource = new ProtocolFundingSource(SPONSOR_NUMBER_BAD, FundingSourceType.SPONSOR, null, null); assertFalse(protocolFundingSourceService.isValidIdForType(fundingSource)); }