summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/models/moduleReferenceSpec.groovy
blob: d6cb4635d86e98451746d3067627fe285c279281 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package org.onap.cps.ncmp.api.models

import org.onap.cps.spi.model.ModuleReference
import spock.lang.Specification

class moduleReferenceSpec extends Specification {

    def 'lombok data annotation correctly implements toString() and hashCode() methods'() {
        given: 'two moduleReference objects'
            def moduleReference1 = new ModuleReference('module1', "some namespace", '1')
            def moduleReference2 = new ModuleReference('module1', "some namespace", '1')
        when: 'lombok generated methods are called'
        then: 'the methods exist and behaviour is accurate'
            assert moduleReference1.toString() == moduleReference2.toString()
            assert moduleReference1.hashCode() == moduleReference2.hashCode()
        and: 'therefore equals works as expected'
            assert moduleReference1.equals(moduleReference2)
    }

}