From a9c7d62ed82b28733c9df0e905e677bc0474b98a Mon Sep 17 00:00:00 2001 From: Angel Martinez Date: Mon, 16 Sep 2024 08:33:55 +0200 Subject: [PATCH] updated the if and added more test cases --- .../usecase/LeVADocumentUseCase.groovy | 3 +- .../usecase/LeVADocumentUseCaseSpec.groovy | 47 ++++++++++++++----- 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/src/org/ods/orchestration/usecase/LeVADocumentUseCase.groovy b/src/org/ods/orchestration/usecase/LeVADocumentUseCase.groovy index 85fd82a88..b895060e2 100644 --- a/src/org/ods/orchestration/usecase/LeVADocumentUseCase.groovy +++ b/src/org/ods/orchestration/usecase/LeVADocumentUseCase.groovy @@ -646,8 +646,7 @@ class LeVADocumentUseCase extends DocGenUseCase { if (!sections."sec4s2s2") sections."sec4s2s2" = [:] - if (this.project.getProjectProperties()."PROJECT.USES_POO" != null && - Boolean.valueOf(this.project.getProjectProperties()."PROJECT.USES_POO".toString()) == Boolean.TRUE) { + if (Boolean.valueOf(this.project.getProjectProperties()."PROJECT.USES_POO") == Boolean.TRUE) { sections."sec4s2s2" = [ usesPoo : "true", lowDescription : this.project.getProjectProperties()."PROJECT.POO_CAT.LOW", diff --git a/test/groovy/org/ods/orchestration/usecase/LeVADocumentUseCaseSpec.groovy b/test/groovy/org/ods/orchestration/usecase/LeVADocumentUseCaseSpec.groovy index 4d063f5a5..0bfdb37ab 100644 --- a/test/groovy/org/ods/orchestration/usecase/LeVADocumentUseCaseSpec.groovy +++ b/test/groovy/org/ods/orchestration/usecase/LeVADocumentUseCaseSpec.groovy @@ -1,32 +1,53 @@ package org.ods.orchestration.usecase import groovy.json.JsonSlurper -import groovy.util.logging.Log import groovy.util.logging.Slf4j import org.apache.commons.io.FileUtils import org.junit.Rule import org.junit.rules.TemporaryFolder -import org.ods.util.ILogger -import org.ods.services.ServiceRegistry -import spock.lang.Unroll - +import org.ods.orchestration.service.DocGenService +import org.ods.orchestration.service.JiraService +import org.ods.orchestration.service.LeVADocumentChaptersFileService +import org.ods.orchestration.util.DocumentHistory +import org.ods.orchestration.util.MROPipelineUtil +import org.ods.orchestration.util.PDFUtil +import org.ods.orchestration.util.Project +import org.ods.orchestration.util.SortUtil import org.ods.services.JenkinsService import org.ods.services.NexusService import org.ods.services.OpenShiftService -import org.ods.orchestration.service.* -import org.ods.orchestration.util.* +import org.ods.services.ServiceRegistry +import org.ods.util.ILogger import org.ods.util.IPipelineSteps import org.ods.util.Logger +import spock.lang.Unroll +import util.FixtureHelper +import util.SpecHelper -import javax.swing.text.Document import java.nio.file.Files import java.nio.file.NoSuchFileException -import static org.ods.orchestration.usecase.DocumentType.* +import static org.ods.orchestration.usecase.DocumentType.CFTP +import static org.ods.orchestration.usecase.DocumentType.CFTR import static org.ods.orchestration.usecase.DocumentType.CSD -import static util.FixtureHelper.* - -import util.* +import static org.ods.orchestration.usecase.DocumentType.DIL +import static org.ods.orchestration.usecase.DocumentType.DTP +import static org.ods.orchestration.usecase.DocumentType.DTR +import static org.ods.orchestration.usecase.DocumentType.IVP +import static org.ods.orchestration.usecase.DocumentType.IVR +import static org.ods.orchestration.usecase.DocumentType.OVERALL_DTR +import static org.ods.orchestration.usecase.DocumentType.OVERALL_TIR +import static org.ods.orchestration.usecase.DocumentType.RA +import static org.ods.orchestration.usecase.DocumentType.SSDS +import static org.ods.orchestration.usecase.DocumentType.TCP +import static org.ods.orchestration.usecase.DocumentType.TCR +import static org.ods.orchestration.usecase.DocumentType.TIP +import static org.ods.orchestration.usecase.DocumentType.TIR +import static org.ods.orchestration.usecase.DocumentType.TRC +import static util.FixtureHelper.createJUnitXMLTestResults +import static util.FixtureHelper.createProject +import static util.FixtureHelper.createProjectBuildEnvironment +import static util.FixtureHelper.createSockShopJUnitXmlTestResults @Slf4j class LeVADocumentUseCaseSpec extends SpecHelper { @@ -1993,5 +2014,7 @@ class LeVADocumentUseCaseSpec extends SpecHelper { "FALSE" | [:] "invalidValue" | [:] null | [:] + true | [usesPoo:"true", lowDescription:"low", mediumDescription:"medium", highDescription:"high"] + false | [:] } }