diff options
author | ebo <eliezio.oliveira@est.tech> | 2019-08-22 15:20:39 +0100 |
---|---|---|
committer | ebo <eliezio.oliveira@est.tech> | 2019-08-23 09:06:28 +0100 |
commit | d462f728541ad1767e78a994cfd1dc1a02a2885a (patch) | |
tree | 72243591ad6dc2fddacb0f19b62f7ba1268ced36 /ms/blueprintsprocessor/application/src/test | |
parent | 9b893196ff991931d31c412d822e5c24c643098d (diff) |
Prevent obscure NPE when mocks aren't properly configured
Change-Id: Ibccc712e9ff6b022a55b1ffaaf284d203c8b0dfb
Issue-ID: CCSDK-1638
Signed-off-by: ebo <eliezio.oliveira@est.tech>
Diffstat (limited to 'ms/blueprintsprocessor/application/src/test')
-rw-r--r-- | ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintsAcceptanceTest.kt | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintsAcceptanceTest.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintsAcceptanceTest.kt index ad4173c9e..adb6de101 100644 --- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintsAcceptanceTest.kt +++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintsAcceptanceTest.kt @@ -35,6 +35,7 @@ import org.junit.ClassRule import org.junit.Rule import org.junit.runner.RunWith import org.junit.runners.Parameterized +import org.mockito.Answers import org.onap.ccsdk.cds.blueprintsprocessor.rest.RestLibConstants import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService @@ -105,7 +106,7 @@ class BlueprintsAcceptanceTest(private val blueprintName: String, private val fi @JvmField val springMethodRule = SpringMethodRule() - @MockBean(name = RestLibConstants.SERVICE_BLUEPRINT_REST_LIB_PROPERTY) + @MockBean(name = RestLibConstants.SERVICE_BLUEPRINT_REST_LIB_PROPERTY, answer = Answers.RETURNS_SMART_NULLS) lateinit var restClientFactory: BluePrintRestLibPropertyService @Autowired @@ -160,7 +161,8 @@ class BlueprintsAcceptanceTest(private val blueprintName: String, private val fi private fun createRestClientMock(selector: String, restExpectations: List<ExpectationDefinition>) : BlueprintWebClientService { - val restClient = mock<BlueprintWebClientService>(verboseLogging = true) + val restClient = mock<BlueprintWebClientService>(verboseLogging = true, + defaultAnswer = Answers.RETURNS_SMART_NULLS) // Delegates to overloaded exchangeResource(String, String, String, Map<String, String>) whenever(restClient.exchangeResource(any(), any(), any())) |