From d462f728541ad1767e78a994cfd1dc1a02a2885a Mon Sep 17 00:00:00 2001 From: ebo Date: Thu, 22 Aug 2019 15:20:39 +0100 Subject: Prevent obscure NPE when mocks aren't properly configured Change-Id: Ibccc712e9ff6b022a55b1ffaaf284d203c8b0dfb Issue-ID: CCSDK-1638 Signed-off-by: ebo --- .../onap/ccsdk/cds/blueprintsprocessor/BlueprintsAcceptanceTest.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ms') 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) : BlueprintWebClientService { - val restClient = mock(verboseLogging = true) + val restClient = mock(verboseLogging = true, + defaultAnswer = Answers.RETURNS_SMART_NULLS) // Delegates to overloaded exchangeResource(String, String, String, Map) whenever(restClient.exchangeResource(any(), any(), any())) -- cgit 1.2.3-korg