diff options
Diffstat (limited to 'common-logging/src/test/java/org/onap/policy/common/logging/eelf/ErrorCodeMapTest.java')
-rw-r--r-- | common-logging/src/test/java/org/onap/policy/common/logging/eelf/ErrorCodeMapTest.java | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/ErrorCodeMapTest.java b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/ErrorCodeMapTest.java new file mode 100644 index 00000000..ed4c879f --- /dev/null +++ b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/ErrorCodeMapTest.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP-Logging + * ================================================================================ + * Copyright (C) 2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.policy.common.logging.eelf; + +import static org.junit.Assert.*; +import org.junit.Test; +import org.onap.policy.common.logging.eelf.ErrorCodeMap.ErrorCodeInfo; + +public class ErrorCodeMapTest { + + @Test + public void testGetErrorCodeInfo() { + assertNotNull(ErrorCodeMap.getErrorCodeInfo(MessageCodes.EXCEPTION_ERROR)); + assertNotNull(ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR)); + assertNotNull(ErrorCodeMap.getErrorCodeInfo(MessageCodes.MISS_PROPERTY_ERROR)); + assertNotNull(ErrorCodeMap.getErrorCodeInfo(MessageCodes.UPDATE_ERROR)); + assertNotNull(ErrorCodeMap.getErrorCodeInfo(MessageCodes.ERROR_SYSTEM_ERROR)); + assertNotNull(ErrorCodeMap.getErrorCodeInfo(MessageCodes.ERROR_DATA_ISSUE)); + assertNotNull(ErrorCodeMap.getErrorCodeInfo(MessageCodes.ERROR_PERMISSIONS)); + assertNotNull(ErrorCodeMap.getErrorCodeInfo(MessageCodes.ERROR_DATA_ISSUE)); + assertNotNull(ErrorCodeMap.getErrorCodeInfo(MessageCodes.ERROR_PROCESS_FLOW)); + assertNotNull(ErrorCodeMap.getErrorCodeInfo(MessageCodes.ERROR_SCHEMA_INVALID)); + assertNotNull(ErrorCodeMap.getErrorCodeInfo(MessageCodes.ERROR_UNKNOWN)); + assertNotNull(ErrorCodeMap.getErrorCodeInfo(MessageCodes.ERROR_AUDIT)); + } + + @Test + public void testErrorCodeInfoGetErrorCode() { + ErrorCodeInfo errorCodeInfo = ErrorCodeMap.getErrorCodeInfo(MessageCodes.EXCEPTION_ERROR); + assertEquals("POLICY-503E", errorCodeInfo.getErrorCode()); + } + + @Test + public void testErrorCodeInfoGetErrorDesc() { + ErrorCodeInfo errorCodeInfo = ErrorCodeMap.getErrorCodeInfo(MessageCodes.EXCEPTION_ERROR); + assertEquals("This is an exception error message during the process. Please check the error message for detail information", errorCodeInfo.getErrorDesc()); + } + +} |