diff options
author | siddharth0905 <siddharth.singh4@amdocs.com> | 2018-08-21 17:55:30 +0530 |
---|---|---|
committer | Vitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com> | 2018-09-13 11:00:08 +0000 |
commit | c58f445fcef56a6440f3b21d54b390700623c48c (patch) | |
tree | 9540ba4f1c7c2ec92c07ce2abcd04d02e06033cc /openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main | |
parent | 7678396a1df3122d80d838c958d857f03e2aefbb (diff) |
Test coverage
Increase test coverage
Change-Id: I43e3149d0d4b07dc8e260f3d5fac025197882f3a
Issue-ID: SDC-1673
Signed-off-by: siddharth0905 <siddharth.singh4@amdocs.com>
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main')
-rw-r--r-- | openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/errors/DefaultExceptionMapper.java | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/errors/DefaultExceptionMapper.java b/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/errors/DefaultExceptionMapper.java index 34ede43d1e..618ac59fa4 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/errors/DefaultExceptionMapper.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/errors/DefaultExceptionMapper.java @@ -28,12 +28,18 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.ext.ExceptionMapper; +import org.apache.commons.collections4.CollectionUtils; import org.codehaus.jackson.map.JsonMappingException; import org.hibernate.validator.internal.engine.path.PathImpl; -import org.openecomp.core.utilities.CommonMethods; import org.openecomp.core.utilities.file.FileUtils; import org.openecomp.core.utilities.json.JsonUtil; -import org.openecomp.sdc.common.errors.*; +import org.openecomp.sdc.common.errors.CoreException; +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; +import org.openecomp.sdc.common.errors.ErrorCodeAndMessage; +import org.openecomp.sdc.common.errors.GeneralErrorBuilder; +import org.openecomp.sdc.common.errors.JsonMappingErrorBuilder; +import org.openecomp.sdc.common.errors.ValidationErrorBuilder; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; @@ -98,14 +104,14 @@ public class DefaultExceptionMapper implements ExceptionMapper<Exception> { String message; String fieldName = null; - if (!CommonMethods.isEmpty(constraintViolationSet)) { + if (CollectionUtils.isEmpty(constraintViolationSet)) { + message = validationException.getMessage(); + } else { // getting the first violation message for the output response. ConstraintViolation<?> constraintViolation = constraintViolationSet.iterator().next(); message = constraintViolation.getMessage(); fieldName = getFieldName(constraintViolation.getPropertyPath()); - } else { - message = validationException.getMessage(); } ErrorCode validationErrorCode = new ValidationErrorBuilder(message, fieldName).build(); |