diff options
author | aribeiro <anderson.ribeiro@est.tech> | 2021-02-23 17:24:08 +0000 |
---|---|---|
committer | Vasyl Razinkov <vasyl.razinkov@est.tech> | 2021-02-25 13:37:43 +0000 |
commit | 6ac7274a7149f03eb464c94a3c2c1132feb04818 (patch) | |
tree | dfa44985ec2315f6a48ba2119d80e7ace8dde947 /catalog-be/src/main/java | |
parent | 94133cb583800ecd72ee0c736284c6ead18450c9 (diff) |
Increase test coverage
Unit tests for CapabilityServlet
Issue-ID: SDC-3485
Signed-off-by: aribeiro <anderson.ribeiro@est.tech>
Change-Id: Ib516105b9a160f80aa77f368ab20b3bb6f7c0580
Diffstat (limited to 'catalog-be/src/main/java')
-rw-r--r-- | catalog-be/src/main/java/org/openecomp/sdc/be/servlets/CapabilityServlet.java | 6 |
1 files changed, 5 insertions, 1 deletions
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<CapabilityDefinition> mappedCapabilitiesData = mappedCapabilitiesDataEither.left().value(); Either<List<CapabilityDefinition>, ResponseFormat> actionResponse; @@ -350,6 +350,10 @@ public class CapabilityServlet extends AbstractValidationsServlet { Either<UiComponentDataTransfer, ResponseFormat> mappedData = getComponentsUtils() .convertJsonToObjectUsingObjectMapper(inputJson, user, UiComponentDataTransfer.class, AuditingActionEnum.CREATE_RESOURCE, componentTypeEnum); + if (mappedData.isRight()) { + return Either.right(getComponentsUtils() + .getResponseFormat(ActionStatus.INVALID_CONTENT)); + } Optional<List<CapabilityDefinition>> capabilityDefinitionList = mappedData.left().value().getCapabilities().values().stream().findFirst(); return capabilityDefinitionList.<Either<List<CapabilityDefinition>, ResponseFormat>> |