Skip to content

Commit

Permalink
Updated LevaDocumentUseCase to use poo property value correctly and a…
Browse files Browse the repository at this point in the history
…dded test
  • Loading branch information
Angel Martinez committed Sep 13, 2024
1 parent bf64746 commit 94e0b55
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ class LeVADocumentUseCase extends DocGenUseCase {
if (!sections."sec4s2s2") sections."sec4s2s2" = [:]

if (this.project.getProjectProperties()."PROJECT.USES_POO" != null &&
this.project.getProjectProperties()."PROJECT.USES_POO".toString().equalsIgnoreCase("true")) {
Boolean.valueOf(this.project.getProjectProperties()."PROJECT.USES_POO".toString()) == Boolean.TRUE) {
sections."sec4s2s2" = [
usesPoo : "true",
lowDescription : this.project.getProjectProperties()."PROJECT.POO_CAT.LOW",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1957,4 +1957,41 @@ class LeVADocumentUseCaseSpec extends SpecHelper {
true | CSD as String | "IN PROGRESS" | "2" || true
}

@Unroll
def "fillRASections update section sec4s2s2 according to project property PROJECT.USES_POO"() {
given:
def sections = ["sec4s2s2":[]]
def risks = [[:]]
def proposedMeasuresDesription = [[:]]
def low = "low"
def medium = "medium"
def high = "high"
def project = Mock(Project)
jiraUseCase = Spy(new JiraUseCase(project, steps, util, Mock(JiraService), logger))
usecase = Spy(new LeVADocumentUseCase(project, steps, util, docGen, jenkins, jiraUseCase, junit, levaFiles, nexus, os, pdf, sq, bbt, logger))

when:
usecase.fillRASections(sections, risks, proposedMeasuresDesription)

then:
project.getProjectProperties() >> [
"PROJECT.NON-GXP_EVALUATION" : "",
"PROJECT.USES_POO" : poo,
"PROJECT.POO_CAT.LOW" : low,
"PROJECT.POO_CAT.MEDIUM" : medium,
"PROJECT.POO_CAT.HIGH": high
]

and:
sections.sec4s2s2 == expectedResult

where:
poo | expectedResult
"true" | [usesPoo:"true", lowDescription:"low", mediumDescription:"medium", highDescription:"high"]
"false" | [:]
"TRUE" | [usesPoo:"true", lowDescription:"low", mediumDescription:"medium", highDescription:"high"]
"FALSE" | [:]
"invalidValue" | [:]
null | [:]
}
}

0 comments on commit 94e0b55

Please sign in to comment.