Merge "Implement merging all ncmp datastore endpoints into one"
[cps.git] / cps-ncmp-rest / src / test / groovy / org / onap / cps / ncmp / rest / controller / handlers / NcmpDatastoreResourceRequestHandlerFactorySpec.groovy
1 package org.onap.cps.ncmp.rest.controller.handlers
2
3 import spock.lang.Specification
4
5 class NcmpDatastoreResourceRequestHandlerFactorySpec extends Specification {
6
7     def objectUnderTest = new NcmpDatastoreResourceRequestHandlerFactory(null, null)
8
9     def 'Creating ncmp datastore request handlers.'() {
10         when: 'a ncmp datastore request handler is created for #datastoreType'
11             def result = objectUnderTest.getNcmpDatastoreResourceRequestHandler(datastoreType)
12         then: 'the result is of the expected class'
13             result.class == expectedClass
14         where: 'the following type of datastore is used'
15             datastoreType                         || expectedClass
16             DatastoreType.OPERATIONAL             || NcmpDatastoreOperationalResourceRequestHandler
17             DatastoreType.PASSTHROUGH_OPERATIONAL || NcmpDatastorePassthroughOperationalResourceRequestHandler
18             DatastoreType.PASSTHROUGH_RUNNING     || NcmpDatastorePassthroughRunningResourceRequestHandler
19     }
20 }