From 05bf733e32e24c945b00c08f1d1d2e69da9d5eff Mon Sep 17 00:00:00 2001 From: "Bonkur, Venkat" Date: Mon, 30 Sep 2019 11:53:30 -0400 Subject: Add null check for the InfraActiveRequests lookup Add null check for the InfraActiveRequests lookup move it into a separate method for InfraActiveRequests lookup Issue-ID: SO-2374 Signed-off-by: Benjamin, Max (mb388a) Change-Id: I84ff23b4da12719b589d43135a7604a2d4b24fef --- .../onap/so/apihandlerinfra/OrchestrationRequestsTest.java | 2 +- .../so/apihandlerinfra/OrchestrationRequestsUnitTest.java | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'mso-api-handlers/mso-api-handler-infra/src/test/java/org') diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java index 12f0ffcc11..151785dbeb 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java @@ -335,7 +335,7 @@ public class OrchestrationRequestsTest extends BaseTest { expectedRequestError = new RequestError(); se = new ServiceException(); se.setMessageId(ErrorNumbers.SVC_DETAILED_SERVICE_ERROR); - se.setText("Null response from RequestDB when searching by RequestId"); + se.setText("Null response from RequestDB when searching by RequestId " + INVALID_REQUEST_ID); expectedRequestError.setServiceException(se); builder = UriComponentsBuilder.fromHttpUrl( diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java index 627bbc631d..47aa3cccb5 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java @@ -21,6 +21,7 @@ package org.onap.so.apihandlerinfra; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertEquals; @@ -39,6 +40,7 @@ import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.apihandler.common.ResponseBuilder; import org.onap.so.apihandlerinfra.exceptions.ApiException; +import org.onap.so.apihandlerinfra.exceptions.ValidateException; import org.onap.so.constants.OrchestrationRequestFormat; import org.onap.so.constants.Status; import org.onap.so.db.request.beans.InfraActiveRequests; @@ -327,4 +329,13 @@ public class OrchestrationRequestsUnitTest { assertEquals(Status.FAILED.toString(), result); } + + @Test + public void infraActiveRequestNullValidationExceptionTest() throws ApiException { + iar.setRequestId(REQUEST_ID); + thrown.expect(ValidateException.class); + thrown.expectMessage(containsString("Null response from RequestDB when searching by RequestId " + REQUEST_ID)); + orchestrationRequests.infraActiveRequestLookup(iar.getRequestId()); + } + } -- cgit 1.2.3-korg