Fix sonar code smells 42/128942/3
authorkissand <andras.zoltan.kiss@est.tech>
Thu, 28 Apr 2022 08:20:39 +0000 (10:20 +0200)
committerkissand <andras.zoltan.kiss@est.tech>
Fri, 29 Apr 2022 10:14:31 +0000 (12:14 +0200)
* Increase code coverage
  https://sonarcloud.io/component_measures?metric=uncovered_conditions&id=onap_cps

Issue-ID: CPS-475
Change-Id: I124bad6c01acbcb9658f52eb68079628e074168e
Signed-off-by: kissand <andras.zoltan.kiss@est.tech>
cps-service/src/test/groovy/org/onap/cps/yang/YangTextSchemaSourceSetBuilderSpec.groovy [moved from cps-service/src/test/groovy/org/onap/cps/utils/YangTextSchemaSourceSetSpec.groovy with 88% similarity]

@@ -1,7 +1,7 @@
 /*
  *  ============LICENSE_START=======================================================
  *  Copyright (C) 2020-2021 Pantheon.tech
- *  Modifications Copyright (C) 2020-2021 Nordix Foundation
+ *  Modifications Copyright (C) 2020-2022 Nordix Foundation
  *  Modifications Copyright (C) 2021 Bell Canada.
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  ============LICENSE_END=========================================================
  */
 
-package org.onap.cps.utils
+package org.onap.cps.yang
+
 
 import org.onap.cps.TestUtils
 import org.onap.cps.spi.exceptions.ModelValidationException
-import org.onap.cps.yang.YangTextSchemaSourceSetBuilder
 import org.opendaylight.yangtools.yang.common.Revision
 import spock.lang.Specification
 
-class YangTextSchemaSourceSetSpec extends Specification {
+class YangTextSchemaSourceSetBuilderSpec extends Specification {
 
     def 'Building a valid YangTextSchemaSourceSet using #filenameCase filename.'() {
         given: 'a yang model (file)'
             def yangResourceNameToContent = [filename: TestUtils.getResourceFileContent('bookstore.yang')]
         when: 'the content is parsed'
             def result = YangTextSchemaSourceSetBuilder.of(yangResourceNameToContent).getSchemaContext()
-        then: 'the result contains 1 module of the correct name and revision'
+        then: 'it can be validated successfully'
+            YangTextSchemaSourceSetBuilder.validate(yangResourceNameToContent)
+        and: 'the result contains 1 module of the correct name and revision'
             result.modules.size() == 1
             def optionalModule = result.findModule('stores', Revision.of('2020-09-15'))
             optionalModule.isPresent()