src_fm_fc_ms_ff stringlengths 43 86.8k | target stringlengths 20 276k |
|---|---|
FinanceLinksUtil { public Optional<String> financesLink(OrganisationResource organisation, List<ProcessRoleResource> processRoles, UserResource user, ApplicationResource application, CompetitionResource competition) { Optional<ProcessRoleResource> currentUserRole = getCurrentUsersRole(processRoles, user); UserResource ... | @Test public void financesLinkForInternalUser() { UserResource user = newUserResource() .withId(userId) .withRoleGlobal(Role.IFS_ADMINISTRATOR) .build(); when(userAuthenticationService.getAuthenticatedUser(any())).thenReturn(user); Optional<String> financeLink = financeLinksUtil.financesLink(organisation, Collections.s... |
GrantProcessServiceImpl implements GrantProcessService { @Override public void createGrantProcess(long applicationId) { Optional<Application> application = applicationRepository.findById(applicationId); application.ifPresent((a) -> { Optional<GrantProcessConfiguration> config = grantProcessConfigurationRepository.findB... | @Test public void createGrantProcessDontSendByDefault() { long applicationId = 7L; long competitionId = 1L; Competition competition = CompetitionBuilder.newCompetition().withId(competitionId).build(); Application application = ApplicationBuilder.newApplication().withId(applicationId).withCompetition(competition).build(... |
ApplicationFundingBreakdownViewModelPopulator { public ApplicationFundingBreakdownViewModel populate(long applicationId, UserResource user) { ApplicationResource application = applicationRestService.getApplicationById(applicationId).getSuccess(); CompetitionResource competition = competitionRestService.getCompetitionBy... | @Test public void populateFinanceBreakdownForLeadAndPartnerForNonKtpApplication() { long applicationId = 1L; long competitionId = 2L; long leadOrganisationId = 3L; long partnerOrganisationId = 4L; long userId = 4L; String financeLinkUrl = "some url"; UserResource user = newUserResource() .withId(userId) .withRoleGlobal... |
ApplicationFinanceSummaryViewModelPopulator { public ApplicationFinanceSummaryViewModel populate(long applicationId, UserResource user) { ApplicationResource application = applicationRestService.getApplicationById(applicationId).getSuccess(); CompetitionResource competition = competitionRestService.getCompetitionById(a... | @Test public void populateFinanceLinksForNonKtpApplication() { setField(populator, "financeSummaryTableViewModelPopulator", financeSummaryTableViewModelPopulator); long applicationId = 1L; long competitionId = 2L; long organisationId = 3L; long userId = 4L; UserResource user = newUserResource() .withId(userId) .withRol... |
ProjectServiceImpl implements ProjectService { @Override public ProjectResource getById(long projectId) { return projectRestService.getProjectById(projectId).getSuccess(); } @Override List<ProjectUserResource> getProjectUsersForProject(long projectId); @Override List<ProjectUserResource> getDisplayProjectUsersForProje... | @Test public void getById() { ProjectResource projectResource = newProjectResource().build(); when(projectRestService.getProjectById(projectResource.getId())).thenReturn(restSuccess(projectResource)); ProjectResource returnedProjectResource = service.getById(projectResource.getId()); assertEquals(projectResource, retur... |
ProjectServiceImpl implements ProjectService { @Override public List<ProjectUserResource> getProjectUsersForProject(long projectId) { return projectRestService.getProjectUsersForProject(projectId).getSuccess(); } @Override List<ProjectUserResource> getProjectUsersForProject(long projectId); @Override List<ProjectUserR... | @Test public void getProjectUsersForProject() { long projectId = 1; List<ProjectUserResource> projectUsers = newProjectUserResource().build(5); when(projectRestService.getProjectUsersForProject(projectId)).thenReturn(restSuccess(projectUsers)); List<ProjectUserResource> returnedProjectUsers = service.getProjectUsersFor... |
ProjectServiceImpl implements ProjectService { @Override public ProjectResource getByApplicationId(long applicationId) { RestResult<ProjectResource> restResult = projectRestService.getByApplicationId(applicationId); if(restResult.isSuccess()){ return restResult.getSuccess(); } else { return null; } } @Override List<Pr... | @Test public void getByApplicationId() { ApplicationResource applicationResource = newApplicationResource().build(); ProjectResource projectResource = newProjectResource().withApplication(applicationResource).build(); when(projectRestService.getByApplicationId(applicationResource.getId())).thenReturn(restSuccess(projec... |
ProjectServiceImpl implements ProjectService { @Override public OrganisationResource getLeadOrganisation(long projectId) { return projectRestService.getLeadOrganisationByProject(projectId).getSuccess(); } @Override List<ProjectUserResource> getProjectUsersForProject(long projectId); @Override List<ProjectUserResource>... | @Test public void getLeadOrganisation() { OrganisationResource organisationResource = newOrganisationResource().build(); ApplicationResource applicationResource = newApplicationResource().build(); ProjectResource projectResource = newProjectResource().withApplication(applicationResource).build(); when(projectRestServic... |
ProjectServiceImpl implements ProjectService { @Override public List<OrganisationResource> getPartnerOrganisationsForProject(long projectId) { List<PartnerOrganisationResource> partnerOrganisationResources = partnerOrganisationRestService.getProjectPartnerOrganisations(projectId).getSuccess(); List<Long> organisationId... | @Test public void getPartnerOrganisationsForProject() { long projectId = 1; long organisationId1 = 12; long organisationId2 = 14; List<PartnerOrganisationResource> partnerOrganisationResources = newPartnerOrganisationResource() .withOrganisation(organisationId1, organisationId2) .build(2); List<OrganisationResource> or... |
ProjectServiceImpl implements ProjectService { @Override public Optional<ProjectUserResource> getProjectManager(long projectId) { return projectRestService.getProjectManager(projectId).toServiceResult().getOptionalSuccessObject(); } @Override List<ProjectUserResource> getProjectUsersForProject(long projectId); @Overri... | @Test public void getProjectManager() { long projectId = 123; long projectManagerId = 987; when(projectRestService.getProjectManager(projectId)) .thenReturn(restSuccess(newProjectUserResource().withUser(projectManagerId).build())); assertTrue(service.getProjectManager(projectId).isPresent()); }
@Test public void getPro... |
ProjectServiceImpl implements ProjectService { @Override public final Boolean isProjectManager(long userId, long projectId) { return getProjectManager(projectId).map(maybePM -> maybePM.isUser(userId)).orElse(false); } @Override List<ProjectUserResource> getProjectUsersForProject(long projectId); @Override List<Project... | @Test public void isProjectManager() { final long projectId = 123; final long projectManagerId = 987; when(projectRestService.getProjectManager(projectId)) .thenReturn(restSuccess(newProjectUserResource().withUser(projectManagerId).build())); assertTrue(service.isProjectManager(projectManagerId, projectId)); } |
ProjectServiceImpl implements ProjectService { @Override public Boolean isProjectFinanceContact(long userId, long projectId) { List<ProjectUserResource> projectFinanceContacts = projectRestService.getProjectFinanceContacts(projectId).getSuccess(); return projectFinanceContacts.stream().anyMatch(pu -> pu.isUser(userId))... | @Test public void isProjectFinanceContact() { final long projectId = 123; final long projectFinanceContactId = 987; List<ProjectUserResource> projectFinanceContacts = Arrays.asList( newProjectUserResource().withUser(projectFinanceContactId).build(), newProjectUserResource().withUser(anyLong()).build() ); when(projectRe... |
ProjectServiceImpl implements ProjectService { @Override public boolean userIsPartnerInOrganisationForProject(long projectId, long organisationId, long userId) { List<ProjectUserResource> thisProjectUsers = getProjectUsersForProject(projectId); List<ProjectUserResource> projectUsersForOrganisation = simpleFilter(thisPr... | @Test public void userIsPartnerInOrganisationForProject(){ long projectId = 1; long userId = 2; long expectedOrgId = 3; UserResource userResource = newUserResource().withId(userId).build(); setLoggedInUser(userResource); when(projectService.userIsPartnerInOrganisationForProject(projectId, expectedOrgId, userId)).thenRe... |
ProjectServiceImpl implements ProjectService { @Override public Long getOrganisationIdFromUser(long projectId, UserResource user) throws ForbiddenActionException { RestResult<OrganisationResource> organisationResource = organisationRestService.getByUserAndProjectId(user.getId(), projectId); if (organisationResource.toS... | @Test public void getOrganisationIdFromUser() { long projectId = 1; long userId = 2; long expectedOrgId = 3; UserResource userResource = newUserResource().withId(userId).build(); setLoggedInUser(userResource); when(projectService.getOrganisationIdFromUser(projectId, userResource)).thenReturn(expectedOrgId); long organi... |
InviteServiceImpl implements InviteService { @Override public List<ApplicationInviteResource> getPendingInvitationsByApplicationId(Long applicationId) { RestResult<List<InviteOrganisationResource>> pendingAssignableUsersResult = inviteRestService.getInvitesByApplication(applicationId); if(pendingAssignableUsersResult.i... | @Test public void getPendingInvitations() throws Exception { ApplicationResource app = newApplicationResource() .with(id(1L)) .build(); ApplicationInviteResource inv1 = inviteResource("name1", "teamA", InviteStatus.CREATED); ApplicationInviteResource inv2 = inviteResource("name2", "teamA", InviteStatus.SENT); Applicati... |
ControllersUtil { public static boolean isLeadPartner(final PartnerOrganisationRestService partnerOrganisationService, final Long projectId, final Long organisationId) { RestResult<List<PartnerOrganisationResource>> result = partnerOrganisationService.getProjectPartnerOrganisations(projectId); if(null != result && resu... | @Test public void testIsLeadPartner() { Long projectId = 1L; Long organisationId = 2L; PartnerOrganisationResource partnerOrganisationResource = new PartnerOrganisationResource(); partnerOrganisationResource.setOrganisation(organisationId); partnerOrganisationResource.setLeadOrganisation(true); when(partnerOrganisation... |
StatusServiceImpl implements StatusService { @Override public ProjectTeamStatusResource getProjectTeamStatus(Long projectId, Optional<Long> filterByUserId) { return statusRestService.getProjectTeamStatus(projectId, filterByUserId).getSuccess(); } @Override ProjectTeamStatusResource getProjectTeamStatus(Long projectId,... | @Test public void testGetProjectTeamStatus() throws Exception { ProjectTeamStatusResource expectedProjectTeamStatusResource = newProjectTeamStatusResource().build(); when(statusRestService.getProjectTeamStatus(1L, Optional.empty())).thenReturn(restSuccess(expectedProjectTeamStatusResource)); ProjectTeamStatusResource p... |
ProjectDetailsServiceImpl implements ProjectDetailsService { @Override public ServiceResult<Void> updateFinanceContact(ProjectOrganisationCompositeId composite, Long financeContactUserId) { return projectDetailsRestService.updateFinanceContact(composite, financeContactUserId).toServiceResult(); } @Override ServiceResu... | @Test public void updateFinanceContact() { long projectId = 1L; long organisationId = 2L; long financeContactId = 3L; when(projectDetailsRestService.updateFinanceContact(new ProjectOrganisationCompositeId(projectId, organisationId), financeContactId)).thenReturn(restSuccess()); service.updateFinanceContact(new ProjectO... |
ProjectDetailsServiceImpl implements ProjectDetailsService { @Override public ServiceResult<Void> updatePartnerProjectLocation(long projectId, long organisationId, PostcodeAndTownResource postcodeAndTown) { return projectDetailsRestService.updatePartnerProjectLocation(projectId, organisationId, postcodeAndTown).toServi... | @Test public void updatePartnerProjectLocation() { long projectId = 1L; long organisationId = 2L; PostcodeAndTownResource postcodeAndTown = new PostcodeAndTownResource("TW14 9QG", null); when(projectDetailsRestService.updatePartnerProjectLocation(projectId, organisationId, postcodeAndTown)).thenReturn(restSuccess()); S... |
GrantProcessServiceImpl implements GrantProcessService { @Override public void sendSucceeded(long applicationId) { GrantProcess process = grantProcessRepository.findOneByApplicationId(applicationId); grantProcessRepository.save(process.sendSucceeded(ZonedDateTime.now())); } @Override @Transactional(readOnly = true) Op... | @Test public void sendSucceeded() { ZonedDateTime now = ZonedDateTime.now(); long applicationId = 7L; GrantProcess grantProcess = new GrantProcess(applicationId); when(grantProcessRepository.findOneByApplicationId(applicationId)).thenReturn(grantProcess); when(grantProcessRepository.save(grantProcess)).thenReturn(grant... |
ProjectDetailsServiceImpl implements ProjectDetailsService { @Override public ServiceResult<Void> updateProjectManager(Long projectId, Long projectManagerUserId) { return projectDetailsRestService.updateProjectManager(projectId, projectManagerUserId).toServiceResult(); } @Override ServiceResult<Void> updateProjectMana... | @Test public void updateProjectManager() { when(projectDetailsRestService.updateProjectManager(1L, 2L)).thenReturn(restSuccess()); service.updateProjectManager(1L, 2L); verify(projectDetailsRestService).updateProjectManager(1L, 2L); verifyNoMoreInteractions(projectDetailsRestService); } |
ProjectDetailsServiceImpl implements ProjectDetailsService { @Override public ServiceResult<Void> updateProjectStartDate(long projectId, LocalDate projectStartDate) { return projectDetailsRestService.updateProjectStartDate(projectId, projectStartDate).toServiceResult(); } @Override ServiceResult<Void> updateProjectMan... | @Test public void updateProjectStartDate() { LocalDate date = LocalDate.now(); when(projectDetailsRestService.updateProjectStartDate(1L, date)).thenReturn(restSuccess()); ServiceResult<Void> result = service.updateProjectStartDate(1L, date); assertTrue(result.isSuccess()); verify(projectDetailsRestService).updateProjec... |
ProjectDetailsServiceImpl implements ProjectDetailsService { @Override public ServiceResult<Void> updateProjectDuration(long projectId, long durationInMonths) { return projectDetailsRestService.updateProjectDuration(projectId, durationInMonths).toServiceResult(); } @Override ServiceResult<Void> updateProjectManager(Lo... | @Test public void updateProjectDuration() { long projectId = 3L; long durationInMonths = 18L; when(projectDetailsRestService.updateProjectDuration(projectId, durationInMonths)).thenReturn(restSuccess()); ServiceResult<Void> result = service.updateProjectDuration(projectId, durationInMonths); assertTrue(result.isSuccess... |
ProjectDetailsServiceImpl implements ProjectDetailsService { @Override public ServiceResult<Void> updateAddress(Long projectId, AddressResource address) { return projectDetailsRestService.updateProjectAddress(projectId, address).toServiceResult(); } @Override ServiceResult<Void> updateProjectManager(Long projectId, Lo... | @Test public void updateAddress() { long leadOrgId = 1L; long projectId = 2L; AddressResource addressResource = newAddressResource().build(); when(projectDetailsRestService.updateProjectAddress(projectId, addressResource)).thenReturn(restSuccess()); ServiceResult<Void> result = service.updateAddress(projectId, addressR... |
FinanceCheckServiceImpl implements FinanceCheckService { @Override public FinanceCheckResource getByProjectAndOrganisation(ProjectOrganisationCompositeId key) { return financeCheckRestService.getByProjectAndOrganisation(key.getProjectId(), key.getOrganisationId()).getSuccess(); } @Override FinanceCheckResource getByPr... | @Test public void testGet(){ Long projectId = 123L; Long organisationId = 456L; ProjectOrganisationCompositeId key = new ProjectOrganisationCompositeId(projectId, organisationId); FinanceCheckResource financeCheckResource = newFinanceCheckResource().build(); when(financeCheckRestServiceMock.getByProjectAndOrganisation(... |
FinanceCheckServiceImpl implements FinanceCheckService { @Override public ServiceResult<Void> closeQuery(Long queryId) { return queryService.close(queryId).toServiceResult(); } @Override FinanceCheckResource getByProjectAndOrganisation(ProjectOrganisationCompositeId key); @Override ServiceResult<FinanceCheckSummaryRes... | @Test public void testCloseQuery(){ Long queryId = 1L; when(projectFinanceQueriesRestServiceMock.close(queryId)).thenReturn(restSuccess()); ServiceResult<Void> result = service.closeQuery(queryId); assertTrue(result.isSuccess()); verify(projectFinanceQueriesRestServiceMock).close(queryId); } |
InternalProjectSetupRowPopulator { public List<InternalProjectSetupRow> populate(List<ProjectStatusResource> projectStatusResources, CompetitionResource competition, UserResource user) { return projectStatusResources.stream() .map(status -> new InternalProjectSetupRow( status.getProjectTitle(), status.getApplicationNum... | @Test public void populate() { UserResource userResource = newUserResource().build(); List<ProjectSetupStage> projectSetupStages = asList(PROJECT_DETAILS, PROJECT_TEAM); CompetitionResource competitionResource = newCompetitionResource() .withProjectSetupStages(projectSetupStages) .build(); List<ProjectStatusResource> p... |
GrantOfferLetterServiceImpl implements GrantOfferLetterService { @Override public Optional<ByteArrayResource> getGrantOfferFile(Long projectId) { return grantOfferLetterRestService.getGrantOfferFile(projectId).getSuccess(); } @Override Optional<ByteArrayResource> getSignedGrantOfferLetterFile(Long projectId); @Overrid... | @Test public void testGetGrantOfferLetterFile() { Optional<ByteArrayResource> content = Optional.of(new ByteArrayResource("My content!".getBytes())); when(grantOfferLetterRestService.getGrantOfferFile(123L)).thenReturn(restSuccess(content)); Optional<ByteArrayResource> result = grantOfferLetterService.getGrantOfferFile... |
GrantOfferLetterServiceImpl implements GrantOfferLetterService { @Override public Optional<FileEntryResource> getGrantOfferFileDetails(Long projectId) { return grantOfferLetterRestService.getGrantOfferFileDetails(projectId).getSuccess(); } @Override Optional<ByteArrayResource> getSignedGrantOfferLetterFile(Long projec... | @Test public void testGetGrantOfferLetterFileDetails() { FileEntryResource returnedFile = newFileEntryResource().build(); Optional<FileEntryResource> response = Optional.of(returnedFile); when(grantOfferLetterRestService.getGrantOfferFileDetails(123L)).thenReturn(restSuccess(response)); Optional<FileEntryResource> resu... |
GrantOfferLetterServiceImpl implements GrantOfferLetterService { @Override public ServiceResult<FileEntryResource> addSignedGrantOfferLetter(Long projectId, String contentType, long fileSize, String originalFilename, byte[] bytes) { return grantOfferLetterRestService.addSignedGrantOfferLetterFile(projectId, contentType... | @Test public void testAddSignedGrantOfferLetter() { FileEntryResource createdFile = newFileEntryResource().build(); when(grantOfferLetterRestService.addSignedGrantOfferLetterFile(123L, "text/plain", 1000, "filename.txt", "My content!".getBytes())). thenReturn(restSuccess(createdFile)); ServiceResult<FileEntryResource> ... |
GrantProcessServiceImpl implements GrantProcessService { @Override public void sendFailed(long applicationId, String message) { GrantProcess process = grantProcessRepository.findOneByApplicationId(applicationId); grantProcessRepository.save(process.sendFailed(ZonedDateTime.now(), message)); } @Override @Transactional(... | @Test public void sendFailed() { ZonedDateTime now = ZonedDateTime.now(); long applicationId = 7L; String message = "message"; GrantProcess grantProcess = new GrantProcess(applicationId); when(grantProcessRepository.findOneByApplicationId(applicationId)).thenReturn(grantProcess); when(grantProcessRepository.save(grantP... |
GrantOfferLetterServiceImpl implements GrantOfferLetterService { @Override public ServiceResult<FileEntryResource> addGrantOfferLetter(Long projectId, String contentType, long fileSize, String originalFilename, byte[] bytes) { return grantOfferLetterRestService.addGrantOfferLetterFile(projectId, contentType, fileSize, ... | @Test public void testAddGrantOfferLetter() { FileEntryResource createdFile = newFileEntryResource().build(); when(grantOfferLetterRestService.addGrantOfferLetterFile(123L, "text/plain", 1000, "filename.txt", "My content!".getBytes())). thenReturn(restSuccess(createdFile)); ServiceResult<FileEntryResource> result = gra... |
GrantOfferLetterServiceImpl implements GrantOfferLetterService { @Override public ServiceResult<Void> removeGrantOfferLetter(Long projectId) { return grantOfferLetterRestService.removeGrantOfferLetter(projectId).toServiceResult(); } @Override Optional<ByteArrayResource> getSignedGrantOfferLetterFile(Long projectId); @... | @Test public void testRemoveGrantOfferLetter() { long projectId = 123L; when(grantOfferLetterRestService.removeGrantOfferLetter(projectId)).thenReturn(restSuccess()); ServiceResult<Void> result = grantOfferLetterService.removeGrantOfferLetter(projectId); assertTrue(result.isSuccess()); } |
GrantOfferLetterServiceImpl implements GrantOfferLetterService { @Override public ServiceResult<Void> removeAdditionalContractFile(Long projectId) { return grantOfferLetterRestService.removeAdditionalContractFile(projectId).toServiceResult(); } @Override Optional<ByteArrayResource> getSignedGrantOfferLetterFile(Long p... | @Test public void testRemoveAdditionalContractFile() { long projectId = 123L; when(grantOfferLetterRestService.removeAdditionalContractFile(projectId)).thenReturn(restSuccess()); ServiceResult<Void> result = grantOfferLetterService.removeAdditionalContractFile(projectId); assertTrue(result.isSuccess()); } |
GrantOfferLetterServiceImpl implements GrantOfferLetterService { @Override public ServiceResult<Void> removeSignedGrantOfferLetter(Long projectId) { return grantOfferLetterRestService.removeSignedGrantOfferLetter(projectId).toServiceResult(); } @Override Optional<ByteArrayResource> getSignedGrantOfferLetterFile(Long p... | @Test public void testRemoveSignedGrantOfferLetter() { long projectId = 123L; when(grantOfferLetterRestService.removeSignedGrantOfferLetter(projectId)).thenReturn(restSuccess()); ServiceResult<Void> result = grantOfferLetterService.removeSignedGrantOfferLetter(projectId); assertTrue(result.isSuccess()); } |
GrantOfferLetterServiceImpl implements GrantOfferLetterService { @Override public ServiceResult<Void> submitGrantOfferLetter(Long projectId) { return grantOfferLetterRestService.submitGrantOfferLetter(projectId).toServiceResult(); } @Override Optional<ByteArrayResource> getSignedGrantOfferLetterFile(Long projectId); @... | @Test public void testSubmitGrantOfferLetter() { long projectId = 123L; when(grantOfferLetterRestService.submitGrantOfferLetter(projectId)).thenReturn(restSuccess()); ServiceResult<Void> result = grantOfferLetterService.submitGrantOfferLetter(projectId); assertTrue(result.isSuccess()); } |
GrantOfferLetterServiceImpl implements GrantOfferLetterService { @Override public Optional<ByteArrayResource> getAdditionalContractFile(Long projectId) { return grantOfferLetterRestService.getAdditionalContractFile(projectId).getSuccess(); } @Override Optional<ByteArrayResource> getSignedGrantOfferLetterFile(Long proj... | @Test public void testGetAdditionalContractFile() { Optional<ByteArrayResource> content = Optional.of(new ByteArrayResource("My content!".getBytes())); when(grantOfferLetterRestService.getAdditionalContractFile(123L)).thenReturn(restSuccess(content)); Optional<ByteArrayResource> result = grantOfferLetterService.getAddi... |
GrantOfferLetterServiceImpl implements GrantOfferLetterService { @Override public ServiceResult<FileEntryResource> addAdditionalContractFile(Long projectId, String contentType, long fileSize, String originalFilename, byte[] bytes) { return grantOfferLetterRestService.addAdditionalContractFile(projectId, contentType, fi... | @Test public void testAddAdditionalContractFile() { FileEntryResource createdFile = newFileEntryResource().build(); when(grantOfferLetterRestService.addAdditionalContractFile(123L, "text/plain", 1000, "filename.txt", "My content!".getBytes())). thenReturn(restSuccess(createdFile)); ServiceResult<FileEntryResource> resu... |
GrantOfferLetterServiceImpl implements GrantOfferLetterService { @Override public ServiceResult<Void> approveOrRejectSignedGrantOfferLetter(Long projectId, GrantOfferLetterApprovalResource grantOfferLetterApprovalResource) { return grantOfferLetterRestService.approveOrRejectSignedGrantOfferLetter(projectId, grantOfferL... | @Test public void testApproveOrRejectSignedGrantOfferLetter() { GrantOfferLetterApprovalResource grantOfferLetterApprovalResource = new GrantOfferLetterApprovalResource(ApprovalType.APPROVED, null); when(grantOfferLetterRestService.approveOrRejectSignedGrantOfferLetter(123L, grantOfferLetterApprovalResource)).thenRetur... |
GrantOfferLetterServiceImpl implements GrantOfferLetterService { @Override public ServiceResult<Void> sendGrantOfferLetter(Long projectId) { return grantOfferLetterRestService.sendGrantOfferLetter(projectId).toServiceResult(); } @Override Optional<ByteArrayResource> getSignedGrantOfferLetterFile(Long projectId); @Over... | @Test public void testSendGrantOfferLetter() { when(grantOfferLetterRestService.sendGrantOfferLetter(123L)).thenReturn(restSuccess()); ServiceResult<Void> result = grantOfferLetterService.sendGrantOfferLetter(123L); assertTrue(result.isSuccess()); verify(grantOfferLetterRestService).sendGrantOfferLetter(123L); } |
GrantOfferLetterServiceImpl implements GrantOfferLetterService { @Override public ServiceResult<GrantOfferLetterStateResource> getGrantOfferLetterState(Long projectId) { return grantOfferLetterRestService.getGrantOfferLetterState(projectId).toServiceResult(); } @Override Optional<ByteArrayResource> getSignedGrantOffer... | @Test public void testGetGrantOfferLetterState() { Long projectId = 123L; GrantOfferLetterStateResource state = GrantOfferLetterStateResource.stateInformationForNonPartnersView(GrantOfferLetterState.APPROVED, GrantOfferLetterEvent.SIGNED_GOL_APPROVED); when(grantOfferLetterRestService.getGrantOfferLetterState(projectId... |
GrantProcessServiceImpl implements GrantProcessService { @Override @Transactional(readOnly = true) public Optional<GrantProcess> findByApplicationId(Long applicationId) { return Optional.ofNullable(grantProcessRepository.findOneByApplicationId(applicationId)); } @Override @Transactional(readOnly = true) Optional<Grant... | @Test public void getByApplicationIdNotPresent() { long applicationId = 7L; when(grantProcessRepository.findOneByApplicationId(applicationId)).thenReturn(null); Optional<GrantProcess> result = service.findByApplicationId(applicationId); assertFalse(result.isPresent()); }
@Test public void getByApplicationIdPresent() { ... |
ProjectFinanceServiceImpl implements ProjectFinanceService { @Override public List<ProjectFinanceResource> getProjectFinances(Long projectId) { return projectFinanceRestService.getProjectFinances(projectId).getSuccess(); } @Override List<ProjectFinanceResource> getProjectFinances(Long projectId); @Override ViabilityRe... | @Test public void testGetProjectFinances() { List<ProjectFinanceResource> resources = newProjectFinanceResource().build(2); when(projectFinanceRestService.getProjectFinances(123L)).thenReturn(restSuccess(resources)); List<ProjectFinanceResource> financeTotals = service.getProjectFinances(123L); assertEquals(resources, ... |
ProjectFinanceServiceImpl implements ProjectFinanceService { @Override public ViabilityResource getViability(Long projectId, Long organisationId) { return projectFinanceRestService.getViability(projectId, organisationId).getSuccess(); } @Override List<ProjectFinanceResource> getProjectFinances(Long projectId); @Overri... | @Test public void testGetViability() { ViabilityResource viability = new ViabilityResource(ViabilityState.APPROVED, ViabilityRagStatus.GREEN); when(projectFinanceRestService.getViability(123L, 456L)).thenReturn(restSuccess(viability)); ViabilityResource result = service.getViability(123L, 456L); assertEquals(viability,... |
ProjectFinanceServiceImpl implements ProjectFinanceService { @Override public ServiceResult<Void> saveViability(Long projectId, Long organisationId, ViabilityState viability, ViabilityRagStatus viabilityRagRating) { return projectFinanceRestService.saveViability(projectId, organisationId, viability, viabilityRagRating)... | @Test public void testSaveViability() { when(projectFinanceRestService.saveViability(123L, 456L, ViabilityState.APPROVED, ViabilityRagStatus.GREEN)).thenReturn(restSuccess()); service.saveViability(123L, 456L, ViabilityState.APPROVED, ViabilityRagStatus.GREEN); verify(projectFinanceRestService).saveViability(123L, 456L... |
ProjectFinanceServiceImpl implements ProjectFinanceService { @Override public EligibilityResource getEligibility(Long projectId, Long organisationId) { return projectFinanceRestService.getEligibility(projectId, organisationId).getSuccess(); } @Override List<ProjectFinanceResource> getProjectFinances(Long projectId); @... | @Test public void testGetEligibility() { EligibilityResource eligibility = new EligibilityResource(EligibilityState.APPROVED, EligibilityRagStatus.GREEN); when(projectFinanceRestService.getEligibility(123L, 456L)).thenReturn(restSuccess(eligibility)); EligibilityResource result = service.getEligibility(123L, 456L); ass... |
ProjectFinanceServiceImpl implements ProjectFinanceService { @Override public ServiceResult<Void> saveEligibility(Long projectId, Long organisationId, EligibilityState eligibility, EligibilityRagStatus eligibilityRagStatus) { return projectFinanceRestService.saveEligibility(projectId, organisationId, eligibility, eligi... | @Test public void testSaveEligibility() { when(projectFinanceRestService.saveEligibility(123L, 456L, EligibilityState.APPROVED, EligibilityRagStatus.GREEN)).thenReturn(restSuccess()); ServiceResult<Void> result = service.saveEligibility(123L, 456L, EligibilityState.APPROVED, EligibilityRagStatus.GREEN); assertTrue(resu... |
SpendProfileServiceImpl implements SpendProfileService { @Override public ServiceResult<Void> saveSpendProfile(Long projectId, Long organisationId, SpendProfileTableResource table) { return spendProfileRestService.saveSpendProfile(projectId, organisationId, table).toServiceResult(); } @Override ServiceResult<Void> gen... | @Test public void saveSpendProfile() { Long projectId = 1L; Long organisationId = 1L; SpendProfileTableResource table = new SpendProfileTableResource(); when(spendProfileRestService.saveSpendProfile(projectId, organisationId, table)).thenReturn(restSuccess()); ServiceResult<Void> result = service.saveSpendProfile(proje... |
SpendProfileServiceImpl implements SpendProfileService { @Override public ServiceResult<Void> markSpendProfileComplete(Long projectId, Long organisationId) { return spendProfileRestService.markSpendProfileComplete(projectId, organisationId).toServiceResult(); } @Override ServiceResult<Void> generateSpendProfile(Long p... | @Test public void markSpendProfileComplete() { Long projectId = 1L; Long organisationId = 1L; when(spendProfileRestService.markSpendProfileComplete(projectId, organisationId)).thenReturn(restSuccess()); ServiceResult<Void> result = service.markSpendProfileComplete(projectId, organisationId); assertTrue(result.isSuccess... |
SpendProfileServiceImpl implements SpendProfileService { @Override public ServiceResult<Void> markSpendProfileIncomplete(Long projectId, Long organisationId) { return spendProfileRestService.markSpendProfileIncomplete(projectId, organisationId).toServiceResult(); } @Override ServiceResult<Void> generateSpendProfile(Lo... | @Test public void markSpendProfileIncomplete() { Long projectId = 1L; Long organisationId = 1L; when(spendProfileRestService.markSpendProfileIncomplete(projectId, organisationId)).thenReturn(restSuccess()); ServiceResult<Void> result = service.markSpendProfileIncomplete(projectId, organisationId); assertTrue(result.isS... |
SpendProfileServiceImpl implements SpendProfileService { @Override public ServiceResult<Void> completeSpendProfilesReview(Long projectId) { return spendProfileRestService.completeSpendProfilesReview(projectId).toServiceResult(); } @Override ServiceResult<Void> generateSpendProfile(Long projectId); @Override ServiceRes... | @Test public void testCompleteSpendProfileReview() { Long projectId = 1L; when(spendProfileRestService.completeSpendProfilesReview(projectId)).thenReturn(restSuccess()); ServiceResult<Void> result = service.completeSpendProfilesReview(projectId); assertTrue(result.isSuccess()); } |
SpendProfileServiceImpl implements SpendProfileService { @Override public ServiceResult<Void> approveOrRejectSpendProfile(Long projectId, ApprovalType approvalType) { return spendProfileRestService.acceptOrRejectSpendProfile(projectId, approvalType).toServiceResult(); } @Override ServiceResult<Void> generateSpendProfi... | @Test public void approveOrRejectSpendProfile() { Long projectId = 201L; when(spendProfileRestService.acceptOrRejectSpendProfile(projectId, ApprovalType.APPROVED)).thenReturn(restSuccess()); ServiceResult<Void> result = service.approveOrRejectSpendProfile(projectId, ApprovalType.APPROVED); assertTrue(result.isSuccess()... |
SpendProfileServiceImpl implements SpendProfileService { @Override public ApprovalType getSpendProfileStatusByProjectId(Long projectId) { return spendProfileRestService.getSpendProfileStatusByProjectId(projectId).getSuccess(); } @Override ServiceResult<Void> generateSpendProfile(Long projectId); @Override ServiceResul... | @Test public void getSpendProfileStatusByProjectId() { Long projectId = 201L; when(spendProfileRestService.getSpendProfileStatusByProjectId(projectId)).thenReturn(restSuccess(ApprovalType.APPROVED)); ApprovalType result = service.getSpendProfileStatusByProjectId(projectId); assertEquals(ApprovalType.APPROVED, result); ... |
DatesViewModel extends AbstractPublicContentViewModel { public List<DateViewModel> getSortedEvents() { List<DateViewModel> listToBeSorted = getPublicContentDates(); List<DateViewModel> emptyDates = new ArrayList(); List<DateViewModel> sortedList = new ArrayList(); listToBeSorted.stream() .filter(dateViewModel -> null !... | @Test public void getSortedEventsTest() { List<DateViewModel> result = viewModel.getSortedEvents(); assertEquals("Date 2", result.get(0).getContent()); assertEquals("Date 1", result.get(1).getContent()); assertEquals("Date 3", result.get(2).getContent()); } |
DateViewModel { public String getDateTimeFormatted() { if(null == dateTime) { return "Unknown"; } return dateTime.format(DATE_FORMAT); } ZonedDateTime getDateTime(); String getDateTimeFormatted(); void setDateTime(ZonedDateTime dateTime); String getContent(); void setContent(String content); static final DateTimeForma... | @Test public void getDateTimeFormattedTest() { String resultOne = viewModel.getDateTimeFormatted(); assertEquals("Unknown", resultOne); viewModel.setDateTime(ZonedDateTime.of(2015,1,1,0,0,0,0, ZoneId.systemDefault())); String resultTwo = viewModel.getDateTimeFormatted(); assertEquals("1 January 2015", resultTwo); viewM... |
AbstractPublicContentFormPopulator implements PublicContentFormPopulator<F> { public F populate(PublicContentResource publicContentResource) { F form = createInitial(); populateSection(form, publicContentResource); return form; } F populate(PublicContentResource publicContentResource); } | @Test public void testPopulate() { long competitionId = 1L; ContentGroupResource contentGroup = newContentGroupResource() .withHeading("Heading") .withContent("Content") .build(); PublicContentSectionResource contentSection = newPublicContentSectionResource().withType(TEST_TYPE) .withStatus(PublicContentStatus.COMPLETE... |
PublicContentServiceImpl implements PublicContentService { @Override public ServiceResult<Void> updateSection(PublicContentResource resource, PublicContentSectionType section) { return publicContentRestService.updateSection(resource, section).toServiceResult(); } @Override PublicContentResource getCompetitionById(Long... | @Test public void testUpdateSection() { PublicContentResource resource = newPublicContentResource().build(); PublicContentSectionType type = PublicContentSectionType.ELIGIBILITY; when(publicContentRestService.updateSection(resource, type)).thenReturn(restSuccess()); target.updateSection(resource, type).getSuccess(); } |
PublicContentServiceImpl implements PublicContentService { @Override public ServiceResult<Void> markSectionAsComplete(PublicContentResource resource, PublicContentSectionType section) { return publicContentRestService.markSectionAsComplete(resource, section).toServiceResult(); } @Override PublicContentResource getComp... | @Test public void testMarkSectionAsComplete() { PublicContentResource resource = newPublicContentResource().build(); PublicContentSectionType type = PublicContentSectionType.ELIGIBILITY; when(publicContentRestService.markSectionAsComplete(resource, type)).thenReturn(restSuccess()); target.markSectionAsComplete(resource... |
PublicContentServiceImpl implements PublicContentService { @Override public PublicContentResource getCompetitionById(Long id) { return publicContentRestService.getByCompetitionId(id).getSuccess(); } @Override PublicContentResource getCompetitionById(Long id); @Override ServiceResult<Void> publishByCompetitionId(Long p... | @Test public void testGetCompetitionById() { PublicContentResource resource = newPublicContentResource().build(); when(publicContentRestService.getByCompetitionId(COMPETITION_ID)).thenReturn(restSuccess(resource)); PublicContentResource result = target.getCompetitionById(COMPETITION_ID); assertThat(result, equalTo(reso... |
PublicContentServiceImpl implements PublicContentService { @Override public ServiceResult<Void> publishByCompetitionId(Long publicContentId) { return publicContentRestService.publishByCompetitionId(publicContentId).toServiceResult(); } @Override PublicContentResource getCompetitionById(Long id); @Override ServiceResul... | @Test public void testPublishByCompetitionId() { when(publicContentRestService.publishByCompetitionId(COMPETITION_ID)).thenReturn(restSuccess()); ServiceResult<Void> result = target.publishByCompetitionId(COMPETITION_ID); assertTrue(result.isSuccess()); } |
AbstractPublicContentSectionController { @GetMapping("/{competitionId}") public String readOnly(Model model, @PathVariable(COMPETITION_ID_KEY) long competitionId) { return readOnly(competitionId, model, Optional.empty()); } @GetMapping("/{competitionId}") String readOnly(Model model, @PathVariable(COMPETITION_ID_KEY) ... | @Test public void readOnly() throws Exception { CompetitionResource competition = newCompetitionResource().build(); PublicContentResource publicContent = newPublicContentResource().build(); TestPublicContentForm expectedFormPopulated = new TestPublicContentForm(); TestPublicContentViewModel expectedViewModel = new Test... |
AbstractPublicContentSectionController { @GetMapping("/{competitionId}/edit") public String edit(Model model, @PathVariable(COMPETITION_ID_KEY) long competitionId) { return edit(competitionId, model, Optional.empty()); } @GetMapping("/{competitionId}") String readOnly(Model model, @PathVariable(COMPETITION_ID_KEY) lon... | @Test public void edit() throws Exception { CompetitionResource competition = newCompetitionResource().build(); PublicContentResource publicContent = newPublicContentResource().build(); TestPublicContentForm expectedFormPopulated = new TestPublicContentForm(); TestPublicContentViewModel expectedViewModel = new TestPubl... |
GrantProcess { public long getApplicationId() { return applicationId; } GrantProcess(); GrantProcess(long applicationId); GrantProcess(long applicationId, boolean pending); long getApplicationId(); ZonedDateTime getSentRequested(); ZonedDateTime getSentSucceeded(); boolean isPending(); String getMessage(); ZonedDateT... | @Test public void getApplicationId() { assertEquals(APPLICATION_ID, grantProcess.getApplicationId()); assertEquals(APPLICATION_ID, sendRequestedGrantProcess.getApplicationId()); assertEquals(APPLICATION_ID, sendSucceededGrantProcess.getApplicationId()); assertEquals(APPLICATION_ID, sendFailedGrantProcess.getApplication... |
AbstractPublicContentSectionController { @PostMapping(value = "/{competitionId}/edit") public String markAsComplete(Model model, @PathVariable(COMPETITION_ID_KEY) long competitionId, @Valid @ModelAttribute(FORM_ATTR_NAME) F form, BindingResult bindingResult, ValidationHandler validationHandler) { return markAsComplete(... | @Test public void markAsComplete_DatesSection() throws Exception { CompetitionResource competition = newCompetitionResource().build(); PublicContentResource publicContent = newPublicContentResource().build(); TestPublicContentForm expectedFormToSave = new TestPublicContentForm(); TestPublicContentViewModel expectedView... |
AbstractContentGroupController extends AbstractPublicContentSectionController<M, F> { @PostMapping(value = "/{competitionId}/edit", params = "uploadFile") public String saveAndUpload(Model model, @PathVariable(COMPETITION_ID_KEY) long competitionId, @ModelAttribute(FORM_ATTR_NAME) F form, BindingResult bindingResult, V... | @Test public void saveAndUpload() throws Exception { CompetitionResource competition = newCompetitionResource().build(); PublicContentResource publicContent = newPublicContentResource().build(); TestPublicContentForm expectedFormToSave = new TestPublicContentForm(); TestPublicContentForm expectedFormPopulated = new Tes... |
AbstractContentGroupController extends AbstractPublicContentSectionController<M, F> { @PostMapping(value = "/{competitionId}/edit", params = "removeFile") public String saveAndRemove(Model model, @PathVariable(COMPETITION_ID_KEY) long competitionId, @ModelAttribute(FORM_ATTR_NAME) F form, BindingResult bindingResult, V... | @Test public void saveAndRemove() throws Exception { CompetitionResource competition = newCompetitionResource().build(); PublicContentResource publicContent = newPublicContentResource().build(); TestPublicContentForm expectedFormToSave = new TestPublicContentForm(); TestPublicContentForm expectedFormPopulated = new Tes... |
PublicContentMenuPopulator { public PublicContentMenuViewModel populate(CompetitionResource competition, String webBaseUrl) { PublicContentResource publicContent = publicContentService.getCompetitionById(competition.getId()); PublicContentMenuViewModel viewModel = new PublicContentMenuViewModel(); viewModel.setPublishD... | @Test public void testPopulate() { List<PublicContentSectionResource> sections = asList(PublicContentSectionType.values()) .stream() .map(type -> newPublicContentSectionResource().withType(type).build()) .collect(Collectors.toList()); ZonedDateTime date = ZonedDateTime.now(); Boolean publishSetting = Boolean.FALSE; Pub... |
ApplicationFundingDecisionServiceImpl implements ApplicationFundingDecisionService { @Override public ServiceResult<Void> saveApplicationFundingDecisionData(Long competitionId, FundingDecision fundingDecision, List<Long> applicationIds) { if (isAllowedFundingDecision(fundingDecision)) { Map<Long, FundingDecision> appli... | @Test public void saveFundingDecision() throws Exception { List<Long> applicationIds = new ArrayList<>(); applicationIds.add(8L); applicationIds.add(9L); ApplicationSummaryPageResource applicationSummaryPageResource = new ApplicationSummaryPageResource(); List<ApplicationSummaryResource> applicationSummaryResources = n... |
ApplicationFundingDecisionServiceImpl implements ApplicationFundingDecisionService { public Optional<FundingDecision> getFundingDecisionForString(String val) { Optional<FundingDecision> fundingDecision = Optional.empty(); try { fundingDecision = Optional.of(FundingDecision.valueOf(val)); } catch (IllegalArgumentExcepti... | @Test public void saveFundingDecision_getFundingDecisionForStringShouldReturnAppropriateFundingDecision() throws Exception { String fundingDecisionString = "ON_HOLD"; Optional<FundingDecision> fundingDecision = service.getFundingDecisionForString(fundingDecisionString); assertTrue(fundingDecision.isPresent()); assertEq... |
NonIfsDetailsFormPopulator { public NonIfsDetailsForm populate(CompetitionResource competitionResource) { NonIfsDetailsForm form = new NonIfsDetailsForm(); form.setTitle(competitionResource.getName()); form.setInnovationSectorCategoryId(competitionResource.getInnovationSector()); form.setInnovationAreaCategoryId(compet... | @Test public void testPopulate() { CompetitionResource competition = newCompetitionResource() .withName(COMPETITION_NAME).withInnovationSector(INNOVATION_SECTOR).withInnovationAreas(asSet(INNOVATION_AREA)) .withNonIfsUrl(COMPETITION_URL).withFundersPanelEndDate(NOTIFIED).withStartDate(OPEN).withEndDate(CLOSE) .withFund... |
GrantProcess { public ZonedDateTime getSentRequested() { return sentRequested; } GrantProcess(); GrantProcess(long applicationId); GrantProcess(long applicationId, boolean pending); long getApplicationId(); ZonedDateTime getSentRequested(); ZonedDateTime getSentSucceeded(); boolean isPending(); String getMessage(); Z... | @Test public void getSentRequested() { assertNull(grantProcess.getSentRequested()); assertEquals(SEND_REQUESTED_DATE, sendRequestedGrantProcess.getSentRequested()); assertEquals(SEND_REQUESTED_DATE, sendSucceededGrantProcess.getSentRequested()); assertEquals(SEND_REQUESTED_DATE, sendFailedGrantProcess.getSentRequested(... |
NonIfsDetailsFormSaver { public ServiceResult<Void> save(NonIfsDetailsForm form, CompetitionResource competitionResource) { if(!competitionResource.isNonIfs()) { return serviceFailure(CommonFailureKeys.ONLY_NON_IFS_COMPETITION_VALID); } Map<String, GenericMilestoneRowForm> mappedMilestones = createMilestoneMap(form); m... | @Test public void testSaveSuccess() { NonIfsDetailsForm form = createForm(); CompetitionResource competition = newCompetitionResource().withNonIfs(true).build(); List<MilestoneResource> allMilestones = newMilestoneResource().build(1); when(competitionSetupMilestoneService.validateMilestoneDates(any())).thenReturn(empty... |
NonIfsCompetitionController { @GetMapping("/non-ifs-competition/create") public String create() { CompetitionResource competition = competitionSetupRestService.createNonIfs() .getSuccess(); return String.format("redirect:/non-ifs-competition/setup/%s", competition.getId()); } @GetMapping("/non-ifs-competition/create")... | @Test public void testCreate() throws Exception { Long competitionId = 10L; when(competitionSetupRestService.createNonIfs()).thenReturn(restSuccess(newCompetitionResource().withId(competitionId).build())); mockMvc.perform(get("/non-ifs-competition/create/")) .andExpect(status().is3xxRedirection()) .andExpect(redirected... |
NonIfsCompetitionController { @GetMapping("/non-ifs-competition/setup/{competitionId}") public String details(Model model, @PathVariable("competitionId") Long competitionId) { CompetitionResource competition = competitionRestService.getCompetitionById(competitionId).getSuccess(); if (!competition.isNonIfs()) { return "... | @Test public void testDetails() throws Exception { Long competitionId = 11L; CompetitionResource competitionResource = newCompetitionResource().withId(competitionId).withNonIfs(true).build(); NonIfsDetailsForm nonIfsDetailsForm = new NonIfsDetailsForm(); NonIfsDetailsViewModel nonIfsDetailsViewModel = mock(NonIfsDetail... |
NonIfsCompetitionController { @PostMapping("/non-ifs-competition/setup/{competitionId}") public String save(Model model,@Valid @ModelAttribute(FORM_ATTR) NonIfsDetailsForm form, BindingResult bindingResult, ValidationHandler validationHandler, @PathVariable("competitionId") Long competitionId) { CompetitionResource com... | @Test public void testSave() throws Exception { Long competitionId = 11L; CompetitionResource competitionResource = newCompetitionResource().withId(competitionId).withNonIfs(true).build(); when(competitionRestService.getCompetitionById(competitionId)).thenReturn(restSuccess(competitionResource)); when(nonIfsDetailsForm... |
NonIfsDetailsViewModelPopulator { public NonIfsDetailsViewModel populate(CompetitionResource competition) { List<InnovationSectorResource> innovationSectorResourceList = categoryRestService.getInnovationSectors().getSuccess(); removeOpenSector(innovationSectorResourceList); List<InnovationAreaResource> innovationAreaRe... | @Test public void testPopulate() { List<InnovationAreaResource> innovationAreas = new ArrayList<>(); List<InnovationSectorResource> innovationSectors = new ArrayList<>(); when(categoryRestService.getInnovationAreas()).thenReturn(restSuccess(innovationAreas)); when(categoryRestService.getInnovationSectors()).thenReturn(... |
GrantProcess { public ZonedDateTime getSentSucceeded() { return sentSucceeded; } GrantProcess(); GrantProcess(long applicationId); GrantProcess(long applicationId, boolean pending); long getApplicationId(); ZonedDateTime getSentRequested(); ZonedDateTime getSentSucceeded(); boolean isPending(); String getMessage(); Z... | @Test public void getSentSucceeded() { assertNull(grantProcess.getSentSucceeded()); assertNull(sendRequestedGrantProcess.getSentSucceeded()); assertEquals(SEND_SUCCEEDED_DATE, sendSucceededGrantProcess.getSentSucceeded()); assertNull(sendFailedGrantProcess.getSentSucceeded()); } |
AssessmentPermissionRules { @PermissionRule(value = "ASSESSMENT", description = "Only project finance or competition admin can see assessments " + "if the competition is in the correct state.") public boolean assessment(CompetitionCompositeId competitionCompositeId, UserResource loggedInUser) { CompetitionResource comp... | @Test public void reviewPanel() { UserResource loggedInUser = compAdminUser(); for (CompetitionStatus competitionStatus : CompetitionStatus.values()) { final CompetitionResource competition = newCompetitionResource() .withCompetitionStatus(competitionStatus) .build(); when(competitionRestService.getCompetitionById(comp... |
AssessmentPermissionRules { @PermissionRule(value = "ASSESSMENT_APPLICATIONS", description = "Only project finance or competition admin can " + "see assessments if the competition is in the correct state.") public boolean assessmentApplications(CompetitionCompositeId competitionCompositeId, UserResource loggedInUser) {... | @Test public void assessmentApplications() { UserResource loggedInUser = compAdminUser(); for (CompetitionStatus competitionStatus : CompetitionStatus.values()) { final CompetitionResource competition = newCompetitionResource() .withCompetitionStatus(competitionStatus) .build(); CompetitionAssessmentConfigResource comp... |
AssessmentApplicationsController extends BaseAssessmentController { @GetMapping("/applications") public String manageApplications(Model model, @PathVariable("competitionId") long competitionId, @RequestParam(value = "page", defaultValue = "0") int page, @RequestParam(value = "filterSearch", defaultValue = "") String fi... | @Test public void manageApplications() throws Exception { CompetitionResource competitionResource = newCompetitionResource() .withName("name") .withCompetitionStatus(IN_ASSESSMENT) .build(); List<ApplicationCountSummaryResource> summaryResources = newApplicationCountSummaryResource() .withName("one", "two") .withLeadOr... |
AssessmentAssessorProgressController extends CompetitionManagementCookieController<ApplicationSelectionForm> { @GetMapping public String assessorProgress(@PathVariable long competitionId, @PathVariable long assessorId, @ModelAttribute(name = SELECTION_FORM, binding = false) ApplicationSelectionForm selectionForm, @Requ... | @Test public void assessorProgress() throws Exception { long competitionId = 1L; long assessorId = 2L; long applicationId = 18L; AssessorProfileResource assessor = newAssessorProfileResource() .withProfile( newProfileResource() .withBusinessType(ACADEMIC) .withInnovationAreas( newInnovationAreaResource() .withName("Inn... |
AssessmentAssessorProgressController extends CompetitionManagementCookieController<ApplicationSelectionForm> { @PostMapping("/withdraw/{assessmentId}") public String withdrawAssessment(@PathVariable long competitionId, @PathVariable long assessorId, @PathVariable long assessmentId) { assessmentRestService.withdrawAsses... | @Test public void withdrawAssessment() throws Exception { long competitionId = 1L; long assessorId = 2L; long assessmentId = 3L; when(assessmentRestService.withdrawAssessment(assessmentId)).thenReturn(restSuccess()); mockMvc.perform( post("/assessment/competition/{competitionId}/assessors/{assessorId}/withdraw/{assessm... |
AssessmentAssessorProgressController extends CompetitionManagementCookieController<ApplicationSelectionForm> { @GetMapping(value = "/withdraw/{assessmentId}/confirm") public String withdrawAssessmentConfirm( Model model, @PathVariable long competitionId, @PathVariable long assessorId, @PathVariable long assessmentId) {... | @Test public void withdrawAssessmentConfirm() throws Exception { long competitionId = 1L; long assessorId = 2L; long assessmentId = 3L; AssessorAssessmentProgressRemoveViewModel expectedModel = new AssessorAssessmentProgressRemoveViewModel( competitionId, assessorId, assessmentId ); mockMvc.perform( get("/assessment/co... |
InviteAssessorsController extends CompetitionManagementCookieController<AssessorSelectionForm> { @GetMapping public String assessors(@PathVariable("competitionId") long competitionId) { return format("redirect:/competition/%s/assessors/find", competitionId); } @GetMapping String assessors(@PathVariable("competitionId"... | @Test public void assessors() throws Exception { Long competitionId = 1L; mockMvc.perform(get("/competition/{competitionId}/assessors", competitionId)) .andExpect(status().is3xxRedirection()) .andExpect(redirectedUrl(format("/competition/%s/assessors/find", competitionId))); } |
InviteAssessorsController extends CompetitionManagementCookieController<AssessorSelectionForm> { @GetMapping("/find") public String find(Model model, @ModelAttribute(name = SELECTION_FORM, binding = false) AssessorSelectionForm selectionForm, @SuppressWarnings("unused") BindingResult bindingResult, @PathVariable("compe... | @Test public void find() throws Exception { int page = 2; Optional<Long> innovationArea = of(3L); String assessorNameFilter = ""; AvailableAssessorPageResource availableAssessorPageResource = newAvailableAssessorPageResource() .withContent(setUpAvailableAssessorResources()) .build(); List<InnovationSectorResource> expe... |
InviteAssessorsController extends CompetitionManagementCookieController<AssessorSelectionForm> { @GetMapping("/invite") public String invite(Model model, @PathVariable("competitionId") long competitionId, @ModelAttribute(name = FORM_ATTR_NAME, binding = false) InviteNewAssessorsForm form, @RequestParam(defaultValue = "... | @Test public void invite() throws Exception { int page = 0; List<AssessorCreatedInviteResource> assessorCreatedInviteResources = setUpAssessorCreatedInviteResources(); AssessorCreatedInvitePageResource assessorCreatedInvitePageResource = newAssessorCreatedInvitePageResource() .withContent(assessorCreatedInviteResources... |
InviteAssessorsController extends CompetitionManagementCookieController<AssessorSelectionForm> { @PostMapping(value = "/invite", params = {"remove"}) public String removeInviteFromInviteView(Model model, @PathVariable("competitionId") long competitionId, @RequestParam(name = "remove") String email, @RequestParam(defaul... | @Test public void removeInviteFromInviteView() throws Exception { String email = "firstname.lastname@example.com"; when(competitionInviteRestService.deleteInvite(email, competition.getId())).thenReturn(restSuccess()); mockMvc.perform(post("/competition/{competitionId}/assessors/invite", competition.getId()) .param("rem... |
GrantProcess { public boolean isPending() { return pending; } GrantProcess(); GrantProcess(long applicationId); GrantProcess(long applicationId, boolean pending); long getApplicationId(); ZonedDateTime getSentRequested(); ZonedDateTime getSentSucceeded(); boolean isPending(); String getMessage(); ZonedDateTime getLas... | @Test public void isPending() { assertFalse(grantProcess.isPending()); assertTrue(sendRequestedGrantProcess.isPending()); assertFalse(sendSucceededGrantProcess.isPending()); assertTrue(sendFailedGrantProcess.isPending()); } |
InviteAssessorsController extends CompetitionManagementCookieController<AssessorSelectionForm> { private ServiceResult<Void> deleteInvite(String email, long competitionId) { return competitionInviteRestService.deleteInvite(email, competitionId).toServiceResult(); } @GetMapping String assessors(@PathVariable("competiti... | @Test public void removeInviteFromInviteView_defaultParams() throws Exception { String email = "firstname.lastname@example.com"; when(competitionInviteRestService.deleteInvite(email, competition.getId())).thenReturn(restSuccess()); mockMvc.perform(post("/competition/{competitionId}/assessors/invite", competition.getId(... |
InviteAssessorsController extends CompetitionManagementCookieController<AssessorSelectionForm> { @PostMapping(value = "/invite", params = {"removeAll"}) public String removeAllInvitesFromInviteView(Model model, @PathVariable("competitionId") long competitionId, @RequestParam(defaultValue = "0") int page, @SuppressWarni... | @Test public void removeAllInvitesFromInviteView() throws Exception { when(competitionInviteRestService.deleteAllInvites(competition.getId())).thenReturn(restSuccess()); mockMvc.perform(post("/competition/{competitionId}/assessors/invite", competition.getId()) .param("removeAll", "")) .andExpect(status().is3xxRedirecti... |
InviteAssessorsController extends CompetitionManagementCookieController<AssessorSelectionForm> { @PostMapping(value = "/invite", params = {"addNewUser"}) public String addNewUserToInviteView(Model model, @PathVariable("competitionId") long competitionId, @RequestParam(defaultValue = "0") int page, @ModelAttribute(FORM_... | @Test public void addNewUserToInviteView() throws Exception { int page = 0; List<AssessorCreatedInviteResource> assessorCreatedInviteResources = setUpAssessorCreatedInviteResources(); AssessorCreatedInvitePageResource assessorCreatedInvitePageResource = newAssessorCreatedInvitePageResource() .withContent(assessorCreate... |
InviteAssessorsController extends CompetitionManagementCookieController<AssessorSelectionForm> { @PostMapping(value = "/invite", params = {"removeNewUser"}) public String removeNewUserFromInviteView(Model model, @PathVariable("competitionId") long competitionId, @ModelAttribute(FORM_ATTR_NAME) InviteNewAssessorsForm fo... | @Test public void removeNewUserFromInviteView() throws Exception { int page = 0; List<AssessorCreatedInviteResource> assessorCreatedInviteResources = setUpAssessorCreatedInviteResources(); AssessorCreatedInvitePageResource assessorCreatedInvitePageResource = newAssessorCreatedInvitePageResource() .withContent(assessorC... |
InviteAssessorsController extends CompetitionManagementCookieController<AssessorSelectionForm> { @PostMapping(value = "/invite", params = {"inviteNewUsers"}) public String inviteNewUsersFromInviteView(Model model, @PathVariable("competitionId") long competitionId, @RequestParam(defaultValue = "0") int page, @Valid @Mod... | @Test public void inviteNewUsersFromInviteView() throws Exception { NewUserStagedInviteListResource expectedInviteListResource = newNewUserStagedInviteListResource() .withInvites( newNewUserStagedInviteResource() .withEmail("test1@test.com", "test2@test.com") .withName("Tester One", "Tester Two") .withInnovationAreaId(... |
InviteAssessorsController extends CompetitionManagementCookieController<AssessorSelectionForm> { @GetMapping("/accepted") public String accepted(Model model, @PathVariable("competitionId") long competitionId, @RequestParam(defaultValue = "0") int page) { model.addAttribute("model", inviteAssessorsAcceptedModelPopulator... | @Test public void accepted() throws Exception { int page = 1; List<ParticipantStatusResource> status = Collections.singletonList(ACCEPTED); String assessorNameFilter = ""; List<AssessorInviteOverviewResource> assessorInviteOverviewResources = setUpAssessorInviteOverviewResources(); AssessorInviteOverviewPageResource pa... |
AssessmentAssessorsController extends BaseAssessmentController { @GetMapping("/assessors") public String manageAssessors(Model model, @PathVariable("competitionId") long competitionId, @RequestParam(value = "page", defaultValue = "0") int page, @RequestParam(value = "assessorNameFilter", required = false) String assess... | @Test public void manageAssessors() throws Exception { final int pageNumber = 1; final int pageSize = 20; CompetitionResource competitionResource = newCompetitionResource() .withName("name") .withCompetitionStatus(IN_ASSESSMENT) .build(); List<AssessorCountSummaryResource> summaryResources = newAssessorCountSummaryReso... |
AssessmentApplicationProgressController extends CompetitionManagementCookieController<AvailableAssessorForm> { @GetMapping public String applicationProgress(Model model, @ModelAttribute(name = SELECTION_FORM, binding = false) AvailableAssessorForm selectionForm, @PathVariable long applicationId, @PathVariable long comp... | @Test public void applicationProgress() throws Exception { Long competitionId = 1L; Long applicationId = 2L; ApplicationAssessmentSummaryResource applicationAssessmentSummaryResource = setupApplicationAssessmentSummaryResource(competitionId, applicationId); List<ApplicationAssessorResource> assigned = setupAssignedAppl... |
AssessmentApplicationProgressController extends CompetitionManagementCookieController<AvailableAssessorForm> { @PostMapping public String assignAssessor(@PathVariable("competitionId") Long competitionId, @PathVariable("applicationId") Long applicationId, @ModelAttribute(SELECTION_FORM) AvailableAssessorForm selectionFo... | @Test public void assignAssessor() throws Exception { Long competitionId = 1L; Long applicationId = 2L; Long assessorId = 3L; AssessmentCreateResource expectedAssessmentCreateResource = newAssessmentCreateResource() .withApplicationId(applicationId) .withAssessorId(assessorId) .build(); AssessmentResource expectedAsses... |
AssessmentApplicationProgressController extends CompetitionManagementCookieController<AvailableAssessorForm> { @PostMapping("/withdraw/{assessmentId}") public String withdrawAssessment(@PathVariable("competitionId") Long competitionId, @PathVariable("applicationId") Long applicationId, @PathVariable("assessmentId") Lon... | @Test public void withdrawAssessment() throws Exception { Long competitionId = 1L; Long applicationId = 2L; Long assessmentId = 3L; when(assessmentRestService.withdrawAssessment(assessmentId)).thenReturn(restSuccess()); mockMvc.perform( post("/assessment/competition/{competitionId}/application/{applicationId}/assessors... |
GrantProcess { public String getMessage() { return message; } GrantProcess(); GrantProcess(long applicationId); GrantProcess(long applicationId, boolean pending); long getApplicationId(); ZonedDateTime getSentRequested(); ZonedDateTime getSentSucceeded(); boolean isPending(); String getMessage(); ZonedDateTime getLas... | @Test public void getMessage() { assertNull(grantProcess.getMessage()); assertNull(sendRequestedGrantProcess.getMessage()); assertNull(sendSucceededGrantProcess.getMessage()); assertEquals(SEND_FAILED_MESSAGE, sendFailedGrantProcess.getMessage()); } |
AssessmentApplicationProgressController extends CompetitionManagementCookieController<AvailableAssessorForm> { @GetMapping(value = "/withdraw/{assessmentId}/confirm") public String withdrawAssessmentConfirm( Model model, @PathVariable("competitionId") Long competitionId, @PathVariable("applicationId") Long applicationI... | @Test public void withdrawAssessmentConfirm() throws Exception { Long competitionId = 1L; Long applicationId = 2L; Long assessmentId = 3L; ApplicationAssessmentProgressRemoveViewModel expectedModel = new ApplicationAssessmentProgressRemoveViewModel( competitionId, applicationId, assessmentId, TITLE ); mockMvc.perform( ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.