diff options
author | ToineSiebelink <toine.siebelink@est.tech> | 2023-07-24 12:23:05 +0100 |
---|---|---|
committer | ToineSiebelink <toine.siebelink@est.tech> | 2023-07-24 12:23:05 +0100 |
commit | 7fcffe5ae6753bfb6746d18d41ec536092603a76 (patch) | |
tree | 1b88dd469a9a12e411b55019b2501176c0a75665 /cps-path-parser/src/test/groovy/org | |
parent | bdac4402397f4359aeb81bc8acc59900bba99c62 (diff) |
Fix code coverage reporting
- Fixed (partly duplicated) exclusion list: all exlusings now in PARENT pom only
(this means module reports and aggregate report use same exclusion
- Set common minimum to 100% (3 modules now achieve this :-) )
- Added./clean cm-parsre test to get too 10% in that module too
- Increased module specif minima to actual coverge today
Issue-ID: CPS-475
Signed-off-by: ToineSiebelink <toine.siebelink@est.tech>
Change-Id: Ic155f963bfd472e11481fcab6ee8ca227903d9ae
Diffstat (limited to 'cps-path-parser/src/test/groovy/org')
-rw-r--r-- | cps-path-parser/src/test/groovy/org/onap/cps/cpspath/parser/CpsPathQuerySpec.groovy | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/cps-path-parser/src/test/groovy/org/onap/cps/cpspath/parser/CpsPathQuerySpec.groovy b/cps-path-parser/src/test/groovy/org/onap/cps/cpspath/parser/CpsPathQuerySpec.groovy index 0017242abe..ae7ee598ab 100644 --- a/cps-path-parser/src/test/groovy/org/onap/cps/cpspath/parser/CpsPathQuerySpec.groovy +++ b/cps-path-parser/src/test/groovy/org/onap/cps/cpspath/parser/CpsPathQuerySpec.groovy @@ -28,6 +28,18 @@ import static org.onap.cps.cpspath.parser.CpsPathPrefixType.DESCENDANT class CpsPathQuerySpec extends Specification { + def 'Default values for the most basic cps query.'() { + when: 'the cps path is parsed' + def result = CpsPathQuery.createFrom('/parent') + then: 'the query has the correct default properties' + assert result.cpsPathPrefixType == ABSOLUTE + assert result.hasAncestorAxis() == false + assert result.hasLeafConditions() == false + assert result.hasTextFunctionCondition() == false + assert result.hasContainsFunctionCondition() == false + assert result.isPathToListElement() == false + } + def 'Parse cps path with valid cps path and a filter with #scenario.'() { when: 'the given cps path is parsed' def result = CpsPathQuery.createFrom(cpsPath) @@ -131,13 +143,13 @@ class CpsPathQuerySpec extends Specification { when: 'the given cps path is parsed' def result = CpsPathQuery.createFrom(cpsPath) then: 'the query has the right xpath type' - result.cpsPathPrefixType == DESCENDANT + assert result.cpsPathPrefixType == DESCENDANT and: 'leaf conditions are only present when expected' - result.hasLeafConditions() == expectLeafConditions + assert result.hasLeafConditions() == expectLeafConditions and: 'the right text function condition is set' - result.hasTextFunctionCondition() - result.textFunctionConditionLeafName == 'leaf-name' - result.textFunctionConditionValue == 'search' + assert result.hasTextFunctionCondition() + assert result.textFunctionConditionLeafName == 'leaf-name' + assert result.textFunctionConditionValue == 'search' and: 'the ancestor is only present when expected' assert result.hasAncestorAxis() == expectHasAncestorAxis where: 'the following data is used' @@ -152,11 +164,11 @@ class CpsPathQuerySpec extends Specification { when: 'the given cps path is parsed' def result = CpsPathQuery.createFrom('//someContainer[contains(@lang,"en")]') then: 'the query has the right xpath type' - result.cpsPathPrefixType == DESCENDANT + assert result.cpsPathPrefixType == DESCENDANT and: 'the right contains function condition is set' - result.hasContainsFunctionCondition() - result.containsFunctionConditionLeafName == 'lang' - result.containsFunctionConditionValue == 'en' + assert result.hasContainsFunctionCondition() + assert result.containsFunctionConditionLeafName == 'lang' + assert result.containsFunctionConditionValue == 'en' } def 'Parse cps path with error: #scenario.'() { @@ -188,7 +200,7 @@ class CpsPathQuerySpec extends Specification { and: 'the correct ancestor schema node identifier is set' result.ancestorSchemaNodeIdentifier == ancestorPath and: 'there are no leaves conditions' - result.hasLeafConditions() == false + assert result.hasLeafConditions() == false where: scenario | ancestorPath 'basic container' | 'someContainer' @@ -202,14 +214,14 @@ class CpsPathQuerySpec extends Specification { when: 'the given cps path is parsed' def result = CpsPathQuery.createFrom(cpsPath + '/ancestor::someAncestor') then: 'the query has the right type' - result.cpsPathPrefixType == DESCENDANT + assert result.cpsPathPrefixType == DESCENDANT and: 'leaf conditions are only present when expected' - result.hasLeafConditions() == expectLeafConditions + assert result.hasLeafConditions() == expectLeafConditions and: 'the result has ancestor axis' - result.hasAncestorAxis() + assert result.hasAncestorAxis() and: 'the correct ancestor schema node identifier is set' - result.ancestorSchemaNodeIdentifier == 'someAncestor' - result.descendantName == expectedDescendantName + assert result.ancestorSchemaNodeIdentifier == 'someAncestor' + assert result.descendantName == expectedDescendantName where: scenario | cpsPath || expectedDescendantName | expectLeafConditions 'basic container' | '//someContainer' || 'someContainer' | false |