summaryrefslogtreecommitdiffstats
path: root/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/NcmpRestClientSpec.groovy
diff options
context:
space:
mode:
authoremaclee <lee.anjella.macabuhay@est.tech>2022-07-15 12:31:46 +0100
committeremaclee <lee.anjella.macabuhay@est.tech>2022-07-26 10:18:46 +0100
commitf5f5e6be4e7d222a7530b96d2d77ed611934822f (patch)
treee329f206b51163aa70d853bed82010bc820f77bf /src/test/groovy/org/onap/cps/ncmp/dmi/service/client/NcmpRestClientSpec.groovy
parentaf8d434068e6f0d2b88c152b069afdcaf162f6c2 (diff)
Groovy clean tests clean-up
- test labels are modified to set standards for writing tests - labels are not expected to be technical - labels need to be in simple language that ANYONE can understand - labels should not have exact method names except for some mocking - variables are modified to give highlight to ONLY important parameter of test - wild cards are preferred when possible i.e. for exception cases Issue-ID: CPS-588 Signed-off-by: emaclee <lee.anjella.macabuhay@est.tech> Change-Id: I3d42471e7aa4bc61f962ad19cc1f237f6985a9a2
Diffstat (limited to 'src/test/groovy/org/onap/cps/ncmp/dmi/service/client/NcmpRestClientSpec.groovy')
-rw-r--r--src/test/groovy/org/onap/cps/ncmp/dmi/service/client/NcmpRestClientSpec.groovy16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/NcmpRestClientSpec.groovy b/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/NcmpRestClientSpec.groovy
index 32df97b6..4d7e27e2 100644
--- a/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/NcmpRestClientSpec.groovy
+++ b/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/NcmpRestClientSpec.groovy
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation
+ * Copyright (C) 2021-2022 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,8 +37,8 @@ class NcmpRestClientSpec extends Specification {
}
def 'Register a cm handle.'() {
- given: 'json data'
- def jsonData = 'some json'
+ given: 'some request data'
+ def someRequestData = 'some request data'
and: 'configuration data'
mockCpsProperties.baseUrl >> 'http://some-uri'
mockCpsProperties.dmiRegistrationUrl >> 'some-url'
@@ -46,12 +46,12 @@ class NcmpRestClientSpec extends Specification {
mockCpsProperties.authPassword >> 'some-password'
and: 'the rest template returns a valid response entity'
def mockResponseEntity = Mock(ResponseEntity)
- when: 'register cm-handle with ncmp is invoked'
- def result = objectUnderTest.registerCmHandlesWithNcmp(jsonData)
- then: 'the rest template is called with the correct uri and json in the body'
+ when: 'registering a cm handle'
+ def result = objectUnderTest.registerCmHandlesWithNcmp(someRequestData)
+ then: 'the rest template is called with the correct uri and original request data in the body'
1 * mockRestTemplate.exchange({ it.toString() == 'http://some-uri/some-url' },
- HttpMethod.POST, { it.body.contains(jsonData) }, String.class) >> mockResponseEntity
- and: 'the output of the method is equal to the output from the test template'
+ HttpMethod.POST, { it.body.contains(someRequestData) }, String.class) >> mockResponseEntity
+ and: 'the output of the method is equal to the output from the rest template service'
result == mockResponseEntity
}
} \ No newline at end of file