method2testcases
stringlengths
118
6.63k
### Question: ApplicationAssessorResource { public boolean isStarted() { return complementOf(of(CREATED, PENDING, ACCEPTED, REJECTED, WITHDRAWN)).contains(mostRecentAssessmentState); } ApplicationAssessorResource(); ApplicationAssessorResource(Long userId, String firstName, ...
### Question: ApplicationAssessorResource { public boolean isSubmitted() { return SUBMITTED == mostRecentAssessmentState; } ApplicationAssessorResource(); ApplicationAssessorResource(Long userId, String firstName, String lastName, ...
### Question: ApplicationAssessorResource { public boolean isRejected() { return REJECTED == mostRecentAssessmentState; } ApplicationAssessorResource(); ApplicationAssessorResource(Long userId, String firstName, String lastName, ...
### Question: ApplicationAssessorResource { public boolean isWithdrawn() { return WITHDRAWN == mostRecentAssessmentState; } ApplicationAssessorResource(); ApplicationAssessorResource(Long userId, String firstName, String lastName, ...
### Question: AssessmentTotalScoreResource { @JsonIgnore public Integer getTotalScorePercentage() { if (totalScoreGiven == null || totalScoreGiven == 0) { return 0; } return totalScorePossible == 0 ? 0 : Math.round(totalScoreGiven * 100.0f / totalScorePossible); } AssessmentTotalScoreResource(); AssessmentTotalScoreRe...
### Question: OrganisationPermissionRules { @PermissionRule(value = "CREATE", description = "The System Registration User can create Organisations on behalf of non-logged in Users " + "during the regsitration process") public boolean systemRegistrationUserCanCreateOrganisations(OrganisationResource organisation, UserRe...
### Question: CompetitionFundedKeyApplicationStatisticsResource { @JsonIgnore public boolean isCanManageFundingNotifications() { return applicationsFunded > 0 || applicationsNotFunded > 0 || applicationsOnHold > 0; } int getApplicationsSubmitted(); void setApplicationsSubmitted(int applicationsSubmitted); int getAppli...
### Question: CompetitionFundedKeyApplicationStatisticsResource { @JsonIgnore public boolean isCanReleaseFeedback() { return applicationsAwaitingDecision == 0 && applicationsSubmitted == applicationsNotifiedOfDecision; } int getApplicationsSubmitted(); void setApplicationsSubmitted(int applicationsSubmitted); int getA...
### Question: AdditionalCompanyCostCategory implements FinanceRowCostCategory { public AdditionalCompanyCost getAssociateSalary() { return associateSalary; } AdditionalCompanyCost getAssociateSalary(); void setAssociateSalary(AdditionalCompanyCost associateSalary); AdditionalCompanyCost getManagementSupervision(); voi...
### Question: AdditionalCompanyCostCategory implements FinanceRowCostCategory { public AdditionalCompanyCost getManagementSupervision() { return managementSupervision; } AdditionalCompanyCost getAssociateSalary(); void setAssociateSalary(AdditionalCompanyCost associateSalary); AdditionalCompanyCost getManagementSuperv...
### Question: AdditionalCompanyCostCategory implements FinanceRowCostCategory { public AdditionalCompanyCost getOtherStaff() { return otherStaff; } AdditionalCompanyCost getAssociateSalary(); void setAssociateSalary(AdditionalCompanyCost associateSalary); AdditionalCompanyCost getManagementSupervision(); void setManag...
### Question: AdditionalCompanyCostCategory implements FinanceRowCostCategory { public AdditionalCompanyCost getCapitalEquipment() { return capitalEquipment; } AdditionalCompanyCost getAssociateSalary(); void setAssociateSalary(AdditionalCompanyCost associateSalary); AdditionalCompanyCost getManagementSupervision(); v...
### Question: AdditionalCompanyCostCategory implements FinanceRowCostCategory { public AdditionalCompanyCost getConsumables() { return consumables; } AdditionalCompanyCost getAssociateSalary(); void setAssociateSalary(AdditionalCompanyCost associateSalary); AdditionalCompanyCost getManagementSupervision(); void setMan...
### Question: AdditionalCompanyCostCategory implements FinanceRowCostCategory { public AdditionalCompanyCost getOtherCosts() { return otherCosts; } AdditionalCompanyCost getAssociateSalary(); void setAssociateSalary(AdditionalCompanyCost associateSalary); AdditionalCompanyCost getManagementSupervision(); void setManag...
### Question: AdditionalCompanyCostCategory implements FinanceRowCostCategory { @Override @JsonIgnore public List<FinanceRowItem> getCosts() { return newArrayList(associateSalary, managementSupervision, otherStaff, capitalEquipment, consumables, otherCosts); } AdditionalCompanyCost getAssociateSalary(); void setAssoci...
### Question: AdditionalCompanyCostCategory implements FinanceRowCostCategory { @Override public BigDecimal getTotal() { return total; } AdditionalCompanyCost getAssociateSalary(); void setAssociateSalary(AdditionalCompanyCost associateSalary); AdditionalCompanyCost getManagementSupervision(); void setManagementSuperv...
### Question: AdditionalCompanyCostCategory implements FinanceRowCostCategory { @Override public void addCost(FinanceRowItem costItem) { AdditionalCompanyCost cost = (AdditionalCompanyCost) costItem; switch (cost.getType()) { case ASSOCIATE_SALARY: associateSalary = cost; break; case MANAGEMENT_SUPERVISION: managementS...
### Question: AdditionalCompanyCostCategory implements FinanceRowCostCategory { @Override public boolean excludeFromTotalCost() { return true; } AdditionalCompanyCost getAssociateSalary(); void setAssociateSalary(AdditionalCompanyCost associateSalary); AdditionalCompanyCost getManagementSupervision(); void setManageme...
### Question: LabourCostCategory implements FinanceRowCostCategory { @Override public List<FinanceRowItem> getCosts() { return costs; } @Override List<FinanceRowItem> getCosts(); void setCosts(List<FinanceRowItem> costItems); @Override BigDecimal getTotal(); @Override void calculateTotal(); Integer getWorkingDaysPerYe...
### Question: LabourCostCategory implements FinanceRowCostCategory { public Integer getWorkingDaysPerYear() { if (workingDaysPerYearCostItem != null) { return workingDaysPerYearCostItem.getLabourDays(); } else { return 0; } } @Override List<FinanceRowItem> getCosts(); void setCosts(List<FinanceRowItem> costItems); @Ov...
### Question: LabourCostCategory implements FinanceRowCostCategory { public LabourCost getWorkingDaysPerYearCostItem() { return workingDaysPerYearCostItem; } @Override List<FinanceRowItem> getCosts(); void setCosts(List<FinanceRowItem> costItems); @Override BigDecimal getTotal(); @Override void calculateTotal(); Integ...
### Question: LabourCostCategory implements FinanceRowCostCategory { @Override public void addCost(FinanceRowItem costItem) { if (costItem != null) { LabourCost labourCost = (LabourCost) costItem; if (WORKING_DAYS_PER_YEAR.equals(labourCost.getDescription())) { workingDaysPerYearCostItem = (LabourCost) costItem; } else...
### Question: LabourCostCategory implements FinanceRowCostCategory { @Override public boolean excludeFromTotalCost() { return false; } @Override List<FinanceRowItem> getCosts(); void setCosts(List<FinanceRowItem> costItems); @Override BigDecimal getTotal(); @Override void calculateTotal(); Integer getWorkingDaysPerYea...
### Question: ExcludedCostCategory extends DefaultCostCategory { @Override public BigDecimal getTotal() { return BigDecimal.ZERO; } @Override boolean excludeFromTotalCost(); @Override BigDecimal getTotal(); }### Answer: @Test public void getTotal() { grantClaimCategory.calculateTotal(); assertEquals(BigDecimal.ZERO, ...
### Question: ExcludedCostCategory extends DefaultCostCategory { @Override public boolean excludeFromTotalCost() { return true; } @Override boolean excludeFromTotalCost(); @Override BigDecimal getTotal(); }### Answer: @Test public void checkCostCategorySetToExcludeFromTotalCosts() { assertTrue(grantClaimCategory.excl...
### Question: DefaultCostCategory implements FinanceRowCostCategory { @Override public List<FinanceRowItem> getCosts() { return costs; } @Override List<FinanceRowItem> getCosts(); @Override BigDecimal getTotal(); @Override void calculateTotal(); @Override void addCost(FinanceRowItem costItem); @Override boolean exclud...
### Question: DefaultCostCategory implements FinanceRowCostCategory { @Override public BigDecimal getTotal() { return total; } @Override List<FinanceRowItem> getCosts(); @Override BigDecimal getTotal(); @Override void calculateTotal(); @Override void addCost(FinanceRowItem costItem); @Override boolean excludeFromTotal...
### Question: DefaultCostCategory implements FinanceRowCostCategory { @Override public void addCost(FinanceRowItem costItem) { if(costItem!=null) { costs.add(costItem); } } @Override List<FinanceRowItem> getCosts(); @Override BigDecimal getTotal(); @Override void calculateTotal(); @Override void addCost(FinanceRowItem...
### Question: DefaultCostCategory implements FinanceRowCostCategory { @Override public boolean excludeFromTotalCost() { return false; } @Override List<FinanceRowItem> getCosts(); @Override BigDecimal getTotal(); @Override void calculateTotal(); @Override void addCost(FinanceRowItem costItem); @Override boolean exclude...
### Question: OverheadCostCategory implements FinanceRowCostCategory { @Override public List<FinanceRowItem> getCosts() { return costs; } @Override List<FinanceRowItem> getCosts(); @Override BigDecimal getTotal(); @Override void calculateTotal(); @Override void addCost(FinanceRowItem costItem); @Override boolean exclu...
### Question: OverheadCostCategory implements FinanceRowCostCategory { @Override public BigDecimal getTotal() { return total; } @Override List<FinanceRowItem> getCosts(); @Override BigDecimal getTotal(); @Override void calculateTotal(); @Override void addCost(FinanceRowItem costItem); @Override boolean excludeFromTota...
### Question: OrganisationPermissionRules { @PermissionRule(value = "READ", description = "The System Registration User can search for Organisations on behalf of non-logged in " + "users during the registration process") public boolean systemRegistrationUserCanSeeOrganisationSearchResults(OrganisationSearchResult organ...
### Question: OverheadCostCategory implements FinanceRowCostCategory { @Override public void addCost(FinanceRowItem costItem) { if(costItem!=null) { costs.add(costItem); } } @Override List<FinanceRowItem> getCosts(); @Override BigDecimal getTotal(); @Override void calculateTotal(); @Override void addCost(FinanceRowIte...
### Question: OverheadCostCategory implements FinanceRowCostCategory { @Override public boolean excludeFromTotalCost() { return false; } @Override List<FinanceRowItem> getCosts(); @Override BigDecimal getTotal(); @Override void calculateTotal(); @Override void addCost(FinanceRowItem costItem); @Override boolean exclud...
### Question: CapitalUsage extends AbstractFinanceRowItem { @Override public BigDecimal getTotal() { if (npv == null || residualValue == null || utilisation == null) { return BigDecimal.ZERO; } return npv.subtract(residualValue) .multiply(new BigDecimal(utilisation) .divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF...
### Question: CapitalUsage extends AbstractFinanceRowItem { @Override public String getName() { return getCostType().getType(); } private CapitalUsage(); CapitalUsage(Long targetId); CapitalUsage(Long id, Integer deprecation, String description, String existing, BigDecimal npv, BigDecimal res...
### Question: CapitalUsage extends AbstractFinanceRowItem { @Override public boolean isEmpty() { return false; } private CapitalUsage(); CapitalUsage(Long targetId); CapitalUsage(Long id, Integer deprecation, String description, String existing, BigDecimal npv, BigDecimal residualValue, Integ...
### Question: CapitalUsage extends AbstractFinanceRowItem { @Override public FinanceRowType getCostType() { return FinanceRowType.CAPITAL_USAGE; } private CapitalUsage(); CapitalUsage(Long targetId); CapitalUsage(Long id, Integer deprecation, String description, String existing, BigDecimal np...
### Question: ProcurementOverhead extends AbstractFinanceRowItem { @Override public BigDecimal getTotal() { BigDecimal total = BigDecimal.ZERO; if (companyCost != null && projectCost != null) { total = projectCost.multiply(new BigDecimal(companyCost).divide(ONE_HUNDRED)); } return total; } ProcurementOverhead(); Procu...
### Question: LabourCost extends AbstractFinanceRowItem { public BigDecimal getRate(Integer workingDaysPerYear) { rate = getRatePerDay(workingDaysPerYear); return rate; } private LabourCost(); LabourCost(Long targetId); LabourCost(Long id, String name, String role, BigDecimal grossEmployeeCost, Integer labourDays, S...
### Question: LabourCost extends AbstractFinanceRowItem { @Override public BigDecimal getTotal() { return total; } private LabourCost(); LabourCost(Long targetId); LabourCost(Long id, String name, String role, BigDecimal grossEmployeeCost, Integer labourDays, String description, Long targetId); @Override Long getId(...
### Question: Overhead extends AbstractFinanceRowItem { @Override public BigDecimal getTotal() { return BigDecimal.ZERO; } private Overhead(); Overhead(Long targetId); Overhead(Long id, OverheadRateType rateType, Integer rate, Long targetId); Integer getRate(); @Override BigDecimal getTotal(); @Override Long getId()...
### Question: SubContractingCost extends AbstractFinanceRowItem { @Override public BigDecimal getTotal() { return cost; } private SubContractingCost(); SubContractingCost(Long targetId); SubContractingCost(Long id, BigDecimal cost, String country, String name, String role, Long targetId); @Override Long getId(); Big...
### Question: TravelCost extends AbstractFinanceRowItem { @Override public BigDecimal getTotal() { if (cost == null || quantity == null) { return BigDecimal.ZERO; } return cost.multiply(new BigDecimal(quantity)); } private TravelCost(); TravelCost(Long targetId); TravelCost(Long id, String item, BigDecimal cost, Int...
### Question: OtherCost extends AbstractFinanceRowItem { @Override public BigDecimal getTotal() { return cost; } private OtherCost(); OtherCost(Long targetId); OtherCost(Long id, String description, BigDecimal cost, Long targetId); @Override Long getId(); BigDecimal getCost(); String getDescription(); @Override BigD...
### Question: Materials extends AbstractFinanceRowItem { @Override public BigDecimal getTotal() { BigDecimal total = BigDecimal.ZERO; if (quantity != null && cost != null) { total = cost.multiply(new BigDecimal(quantity)); } return total; } private Materials(); Materials(Long targetId); Materials(Long id, String ite...
### Question: ResearchCategoryResource extends CategoryResource { @Override public CategoryType getType() { return RESEARCH_CATEGORY; } @Override CategoryType getType(); }### Answer: @Test public void getType() throws Exception { assertEquals(newResearchCategoryResource().build().getType(), RESEARCH_CATEGORY); }
### Question: InnovationSectorResource extends CategoryResource { @Override public CategoryType getType() { return CategoryType.INNOVATION_SECTOR; } List<InnovationAreaResource> getChildren(); void setChildren(List<InnovationAreaResource> children); @Override CategoryType getType(); @Override boolean equals(Object o);...
### Question: InnovationAreaResource extends CategoryResource { @Override public CategoryType getType() { return INNOVATION_AREA; } @Override CategoryType getType(); Long getSector(); void setSector(Long sector); String getSectorName(); void setSectorName(String sectorName); @JsonIgnore boolean isNone(); @JsonIgnore b...
### Question: InnovationAreaResource extends CategoryResource { @JsonIgnore public boolean isNotNone() { return !isNone(); } @Override CategoryType getType(); Long getSector(); void setSector(Long sector); String getSectorName(); void setSectorName(String sectorName); @JsonIgnore boolean isNone(); @JsonIgnore boolean ...
### Question: FinanceCheckSummaryResource { public boolean isAllEligibilityAndViabilityInReview() { return partnerStatusResources .stream() .allMatch(partner -> partner.getViability().isInReviewOrNotApplicable() && partner.getEligibility().isInReviewOrNotApplicable()); } FinanceCheckSummaryResource(); FinanceCheckSumm...
### Question: CompetitionParticipantResource { @JsonIgnore public long getAssessmentDaysLeft() { return DAYS.between(ZonedDateTime.now(clock), assessorDeadlineDate); } String getCompetitionName(); void setCompetitionName(String competitionName); Long getId(); void setId(Long id); Long getCompetitionId(); void setCompe...
### Question: CompetitionParticipantResource { @JsonIgnore public long getAssessmentDaysLeftPercentage() { return getDaysLeftPercentage(getAssessmentDaysLeft(), DAYS.between(assessorAcceptsDate, assessorDeadlineDate)); } String getCompetitionName(); void setCompetitionName(String competitionName); Long getId(); void s...
### Question: CompetitionParticipantResource { @JsonIgnore public boolean isInAssessment() { return competitionStatus == IN_ASSESSMENT; } String getCompetitionName(); void setCompetitionName(String competitionName); Long getId(); void setId(Long id); Long getCompetitionId(); void setCompetitionId(Long competitionId); ...
### Question: CompetitionParticipantResource { @JsonIgnore public boolean isAnUpcomingAssessment() { return competitionStatus == READY_TO_OPEN || competitionStatus == OPEN || competitionStatus == CLOSED; } String getCompetitionName(); void setCompetitionName(String competitionName); Long getId(); void setId(Long id); ...
### Question: AssessorProfileSkillsModelPopulator { public AssessorProfileSkillsViewModel populateModel(UserResource user, ProfileResource profile, Optional<Long> competitionId, boolean compAdminUser) { CompetitionResource competition = competitionId.map(id -> competitionRestService.getCompetitionById(id).getSuccess())...
### Question: CompetitionController { @GetMapping("overview") public String competitionOverview(final Model model, @PathVariable("competitionId") final long competitionId, UserResource loggedInUser) { final PublicContentItemResource publicContentItem = publicContentItemRestService.getItemByCompetitionId(competitionId)....
### Question: CompetitionController { @GetMapping("info/terms-and-conditions") public String termsAndConditions(@PathVariable("competitionId") final long competitionId, Model model) { CompetitionResource competition = competitionRestService.getCompetitionById(competitionId).getSuccess(); GrantTermsAndConditionsResource...
### Question: CompetitionSearchController { @NotSecured("Not currently secured") @GetMapping public String publicContentSearch(Model model, @RequestParam(value = KEYWORDS_KEY, required = false) Optional<String> keywords, @RequestParam(value = INNOVATION_AREA_ID_KEY, required = false) Optional<Long> innovationAreaId, @R...
### Question: ScopeViewModelPopulator extends AbstractPublicContentGroupViewModelPopulator<ScopeViewModel> { @Override public PublicContentSectionType getType() { return PublicContentSectionType.SCOPE; } @Override PublicContentSectionType getType(); }### Answer: @Test public void getType() { assertEquals(PublicConten...
### Question: SummaryViewModelPopulator extends AbstractPublicContentGroupViewModelPopulator<SummaryViewModel> { @Override protected void populateSection(SummaryViewModel model, PublicContentItemResource publicContentItemResource, PublicContentSectionResource section, Boolean nonIFS) { PublicContentResource publicConte...
### Question: SummaryViewModelPopulator extends AbstractPublicContentGroupViewModelPopulator<SummaryViewModel> { @Override public PublicContentSectionType getType() { return PublicContentSectionType.SUMMARY; } @Override PublicContentSectionType getType(); }### Answer: @Test public void getType() { assertEquals(Public...
### Question: EligibilityViewModelPopulator extends AbstractPublicContentGroupViewModelPopulator<EligibilityViewModel> { @Override public PublicContentSectionType getType() { return PublicContentSectionType.ELIGIBILITY; } @Override PublicContentSectionType getType(); }### Answer: @Test public void getType() { assertE...
### Question: DatesViewModelPopulator extends AbstractPublicContentSectionViewModelPopulator<DatesViewModel> { @Override protected void populateSection(DatesViewModel model, PublicContentItemResource publicContentItemResource, PublicContentSectionResource section, Boolean nonIFS) { List<DateViewModel> publicContentDate...
### Question: OrganisationController { @GetMapping("/find-by-id/{organisationId}") public RestResult<OrganisationResource> findById(@PathVariable("organisationId") final Long organisationId) { return organisationService.findById(organisationId).toGetResponse(); } @GetMapping("/find-by-application-id/{applicationId}") ...
### Question: DatesViewModelPopulator extends AbstractPublicContentSectionViewModelPopulator<DatesViewModel> { @Override public PublicContentSectionType getType() { return PublicContentSectionType.DATES; } @Override PublicContentSectionType getType(); }### Answer: @Test public void getType() { assertEquals(PublicCont...
### Question: HowToApplyViewModelPopulator extends AbstractPublicContentGroupViewModelPopulator<HowToApplyViewModel> { @Override public PublicContentSectionType getType() { return PublicContentSectionType.HOW_TO_APPLY; } @Override PublicContentSectionType getType(); }### Answer: @Test public void getType() { assertEq...
### Question: SupportingInformationViewModelPopulator extends AbstractPublicContentGroupViewModelPopulator<SupportingInformationViewModel> { @Override public PublicContentSectionType getType() { return PublicContentSectionType.SUPPORTING_INFORMATION; } @Override PublicContentSectionType getType(); }### Answer: @Test ...
### Question: OrganisationController { @PostMapping("/create-or-match") public RestResult<OrganisationResource> createOrMatch(@RequestBody OrganisationResource organisation) { return organisationCreationService.createOrMatch(organisation).toPostCreateResponse(); } @GetMapping("/find-by-application-id/{applicationId}")...
### Question: OrganisationController { @GetMapping("/by-user-and-application-id/{userId}/{applicationId}") public RestResult<OrganisationResource> getByUserAndApplicationId(@PathVariable("userId") final long userId, @PathVariable("applicationId") final long applicationId) { return organisationService.getByUserAndApplic...
### Question: PublicContentItemViewModelMapper { public PublicContentItemViewModel mapToViewModel(PublicContentItemResource publicContentItemResource) { PublicContentItemViewModel publicContentItemViewModel = new PublicContentItemViewModel(); publicContentItemViewModel.setCompetitionTitle(publicContentItemResource.getC...
### Question: AcceptGrantsInviteController { @GetMapping("/{hash}") public String inviteEntryPage( @PathVariable final long projectId, @PathVariable final String hash, HttpServletResponse response, Model model, UserResource loggedInUser) { RestResult<String> result = find(inviteByHash(projectId, hash)).andOnSuccess((in...
### Question: OrganisationController { @GetMapping("/by-user-and-project-id/{userId}/{projectId}") public RestResult<OrganisationResource> getByUserAndProjectId(@PathVariable("userId") final long userId, @PathVariable("projectId") final long projectId) { return organisationService.getByUserAndProjectId(userId, projectI...
### Question: OrganisationServiceImpl extends BaseTransactionalService implements OrganisationService { @Override @Transactional public ServiceResult<OrganisationResource> update(final OrganisationResource organisationResource) { return serviceSuccess(organisationMapper.mapToResource(createNewOrganisation(organisationR...
### Question: SetupSectionAccessibilityHelper { public SectionAccess canEditSpendProfileSection(OrganisationResource userOrganisation, Long organisationIdFromUrl) { if (setupProgressChecker.isOfflineOrWithdrawn()) { return NOT_ACCESSIBLE; } if (canAccessSpendProfileSection(userOrganisation) == NOT_ACCESSIBLE) { return ...
### Question: SetupSectionAccessibilityHelper { public SectionAccess canAccessBankDetailsSection(OrganisationResource organisation) { if (organisation.isInternational()) { return NOT_ACCESSIBLE; } if (setupProgressChecker.isOfflineOrWithdrawn()) { return NOT_ACCESSIBLE; } if (!isCompaniesHouseSectionIsUnnecessaryOrComp...
### Question: SetupStatusViewModelPopulator extends AsyncAdaptor { public SetupStatusViewModel populateViewModel(long projectId, UserResource loggedInUser) { ProjectResource project = projectService.getById(projectId); boolean monitoringOfficer = monitoringOfficerService.isMonitoringOfficerOnProject(projectId, loggedIn...
### Question: ProjectManagerController { @PreAuthorize("hasPermission(#projectId, 'org.innovateuk.ifs.project.resource.ProjectCompositeId', 'ACCESS_PROJECT_MANAGER_PAGE')") @PostMapping(value = "/{projectId}/team/project-manager") public String updateProjectManager(@PathVariable("projectId") final long projectId, Model...
### Question: FinanceContactController { @PreAuthorize("hasPermission(#projectId, 'org.innovateuk.ifs.project.resource.ProjectCompositeId', 'ACCESS_FINANCE_CONTACT_PAGE')") @PostMapping(value = "/{projectId}/team/finance-contact/organisation/{organisationId}") public String updateFinanceContact(@PathVariable("projectId...
### Question: FileFunctions { public static final Path pathElementsToPath(List<String> pathElements) { return pathElementsToFile(pathElements).toPath(); } private FileFunctions(); static final String pathElementsToPathString(List<String> pathElements); static final List<String> pathStringToPathElements(final String pa...
### Question: ProjectDetailsStartDateViewModel implements BasicProjectDetailsViewModel { public boolean isKtpCompetition() { return ktpCompetition; } ProjectDetailsStartDateViewModel(ProjectResource project, CompetitionResource competitionResource); Long getApplicationId(); Long getProjectId(); String getProjectName();...
### Question: ProjectDetailsViewModel { public String getLocationForPartnerOrganisation(Long organisationId) { return partnerOrganisations.stream() .filter(partnerOrganisation -> partnerOrganisation.getOrganisation().equals(organisationId)) .findFirst() .map(partnerOrg -> { Optional<OrganisationResource> organisationRe...
### Question: CompaniesHouseApiServiceImpl implements CompaniesHouseApiService { @Override public ServiceResult<OrganisationSearchResult> getOrganisationById(String id) { LOG.debug("getOrganisationById " + id); return ofNullable(restGet("company/" + id, JsonNode.class)). map(jsonNode -> serviceSuccess(companyProfileMap...
### Question: ProjectDetailsViewModel { public boolean isKtpCompetition() { return ktpCompetition; } ProjectDetailsViewModel(ProjectResource project, UserResource currentUser, List<Long> usersPartnerOrganisations, List<OrganisationResourc...
### Question: ProjectDetailsController { @PreAuthorize("hasPermission(#projectId, 'org.innovateuk.ifs.project.resource.ProjectCompositeId', 'ACCESS_PROJECT_DETAILS_SECTION')") @GetMapping("/{projectId}/details/start-date") public String viewStartDate(@PathVariable("projectId") final long projectId, Model model, UserRes...
### Question: SetupCompleteViewModelPopulator { public SetupCompleteViewModel populate(long projectId) { ProjectResource project = projectService.getById(projectId); return new SetupCompleteViewModel( project, getSubmittedTime(project)); } SetupCompleteViewModel populate(long projectId); }### Answer: @Test public voi...
### Question: GrantOfferLetterModel implements BasicProjectDetailsViewModel { public boolean isShowSubmitButton() { return projectManager && !isSubmitted() && isOfferSigned() && grantOfferLetterFile != null; } GrantOfferLetterModel(String title, Long projectId, String projectName, boolean leadPartner, FileDetailsViewMo...
### Question: OrganisationInitialCreationServiceImpl extends BaseTransactionalService implements OrganisationInitialCreationService { @Override @Transactional public ServiceResult<OrganisationResource> createOrMatch(OrganisationResource organisationToCreate) { Optional<Organisation> matchedOrganisation = organisationMa...
### Question: GrantOfferLetterModel implements BasicProjectDetailsViewModel { public boolean isShowGrantOfferLetterRejectedMessage() { if (!isProjectManager()) { return false; } return isGrantOfferLetterRejected(); } GrantOfferLetterModel(String title, Long projectId, String projectName, boolean leadPartner, FileDetail...
### Question: GrantOfferLetterModel implements BasicProjectDetailsViewModel { public boolean isShowGrantOfferLetterReceivedByInnovateMessage() { if (isGrantOfferLetterRejected() && !isLeadPartner()) { return true; } if (isGrantOfferLetterApproved()) { return false; } return isSubmitted(); } GrantOfferLetterModel(String...
### Question: KnowledgeBaseServiceImpl extends RootTransactionalService implements KnowledgeBaseService { @Override public ServiceResult<String> getKnowledgeBaseName(long id) { return find(knowledgeBaseRepository.findById(id), notFoundError(KnowledgeBase.class, singletonList(id))) .andOnSuccessReturn(KnowledgeBase::get...
### Question: GrantOfferLetterModel implements BasicProjectDetailsViewModel { public boolean isShowGrantOfferLetterApprovedByInnovateMessage() { return isGrantOfferLetterApproved(); } GrantOfferLetterModel(String title, Long projectId, String projectName, boolean leadPartner, FileDetailsViewModel grantOfferLetterFile, ...
### Question: PendingPartnerProgressLandingPageController { @GetMapping public String progressLandingPage(@PathVariable long projectId, @PathVariable long organisationId, Model model, @ModelAttribute("form") JoinProjectForm form) { model.addAttribute("model", populator.populate(projectId, organisationId)); return "proj...
### Question: ProjectTermsController { @GetMapping public String getTerms(@PathVariable long projectId, @PathVariable long organisationId, Model model, @ModelAttribute(name = "form", binding = false) ProjectTermsForm form) { ProjectTermsViewModel viewModel = projectTermsModelPopulator.populate(projectId, organisationId...
### Question: ProjectTermsController { @PostMapping public String acceptTerms(@PathVariable long projectId, @PathVariable long organisationId, Model model, @ModelAttribute(name = "form", binding = false) ProjectTermsForm form, @SuppressWarnings("unused") BindingResult bindingResult, ValidationHandler validationHandler)...
### Question: PendingPartnerProgressLandingPageViewModelPopulator { public PendingPartnerProgressLandingPageViewModel populate(long projectId, long organisationId) { ProjectResource project = projectRestService.getProjectById(projectId).getSuccess(); PendingPartnerProgressResource progress = pendingPartnerProgressRestS...
### Question: ProjectTermsModelPopulator { public ProjectTermsViewModel populate(long projectId, long organisationId) { ProjectResource project = projectRestService.getProjectById(projectId).getSuccess(); OrganisationResource organisation = organisationRestService.getOrganisationById(organisationId).getSuccess(); Compe...
### Question: LegacyMonitoringOfficerController { @PreAuthorize("hasPermission(#projectId,'org.innovateuk.ifs.project.resource.ProjectCompositeId', 'ACCESS_MONITORING_OFFICER_SECTION')") @GetMapping("/readonly") public String viewMonitoringOfficerInReadOnly(@P("projectId")@PathVariable("projectId") Long projectId, Mode...
### Question: MonitoringOfficerDashboardController { @GetMapping public String viewDashboard(Model model, UserResource user) { model.addAttribute("model", monitoringOfficerDashboardViewModelPopulator.populate(user)); return "monitoring-officer/dashboard"; } MonitoringOfficerDashboardController(); @Autowired Monitoring...
### Question: KnowledgeBaseServiceImpl extends RootTransactionalService implements KnowledgeBaseService { @Override public ServiceResult<List<String>> getKnowledgeBaseNames() { return serviceSuccess(stream(knowledgeBaseRepository.findAll().spliterator(), false) .map(KnowledgeBase::getName) .collect(toList())); } @Over...