summaryrefslogtreecommitdiffstats
path: root/cps-path-parser/src/test
diff options
context:
space:
mode:
authorRudrangi Anupriya <ra00745022@techmahindra.com>2023-04-17 14:19:46 +0530
committerRudrangi Anupriya <ra00745022@techmahindra.com>2023-04-21 13:44:18 +0530
commitd7bc158cd274b3d6cd01bcad86aef258e6880c1c (patch)
treec94fa03528b6ed4fbb2672267482542dd59f7b73 /cps-path-parser/src/test
parentc4621cbcb1f9aad97ba3389468546444d1e9f3dc (diff)
Add contains condition support to cps-path
Issue-ID: CPS-1272 Change-Id: Ic81d1322cacc64a8752916324b801d02be47d34f Signed-off-by: Rudrangi Anupriya <ra00745022@techmahindra.com>
Diffstat (limited to 'cps-path-parser/src/test')
-rw-r--r--cps-path-parser/src/test/groovy/org/onap/cps/cpspath/parser/CpsPathQuerySpec.groovy11
1 files changed, 11 insertions, 0 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 153dfbe9ed..96fdf88cf6 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
@@ -136,6 +136,17 @@ class CpsPathQuerySpec extends Specification {
'descendant with leaf value and ancestor' | '//child[@other-leaf=1]/leaf-name[text()="search"]/ancestor::parent' || true | true
}
+ def 'Parse #scenario cps path with contains function condition'() {
+ 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
+ and: 'the right contains function condition is set'
+ result.hasContainsFunctionCondition()
+ result.containsFunctionConditionLeafName == 'lang'
+ result.containsFunctionConditionValue == 'en'
+ }
+
def 'Parse cps path with error: #scenario.'() {
when: 'the given cps path is parsed'
CpsPathQuery.createFrom(cpsPath)