From 6ac7274a7149f03eb464c94a3c2c1132feb04818 Mon Sep 17 00:00:00 2001 From: aribeiro Date: Tue, 23 Feb 2021 17:24:08 +0000 Subject: Increase test coverage Unit tests for CapabilityServlet Issue-ID: SDC-3485 Signed-off-by: aribeiro Change-Id: Ib516105b9a160f80aa77f368ab20b3bb6f7c0580 --- .../main/java/org/openecomp/sdc/be/servlets/CapabilityServlet.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'catalog-be/src/main/java') diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/CapabilityServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/CapabilityServlet.java index 999c172bca..a7f2230eed 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/CapabilityServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/CapabilityServlet.java @@ -266,7 +266,7 @@ public class CapabilityServlet extends AbstractValidationsServlet { = getMappedCapabilitiesData(data, modifier, ComponentTypeEnum.findByParamName(componentType)); if(mappedCapabilitiesDataEither.isRight()) { LOGGER.error("Failed to create or update capabilities"); - buildErrorResponse(mappedCapabilitiesDataEither.right().value()); + return buildErrorResponse(mappedCapabilitiesDataEither.right().value()); } List mappedCapabilitiesData = mappedCapabilitiesDataEither.left().value(); Either, ResponseFormat> actionResponse; @@ -350,6 +350,10 @@ public class CapabilityServlet extends AbstractValidationsServlet { Either mappedData = getComponentsUtils() .convertJsonToObjectUsingObjectMapper(inputJson, user, UiComponentDataTransfer.class, AuditingActionEnum.CREATE_RESOURCE, componentTypeEnum); + if (mappedData.isRight()) { + return Either.right(getComponentsUtils() + .getResponseFormat(ActionStatus.INVALID_CONTENT)); + } Optional> capabilityDefinitionList = mappedData.left().value().getCapabilities().values().stream().findFirst(); return capabilityDefinitionList., ResponseFormat>> -- cgit 1.2.3-korg