From 3bfa426f9594bfd4976012a65ac9c27088c86f12 Mon Sep 17 00:00:00 2001 From: pradip01 Date: Mon, 26 Mar 2018 15:40:09 +0530 Subject: Adding Junits for catalog db Increase Jnits coverage for catalog db Issue-ID: SO-532 Change-Id: I7a66a38103b2cf2bdad2d066bcc72a590809be53 Signed-off-by: pradip01 --- .../catalogrest/CatalogQueryExceptionTest.java | 55 ++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryExceptionTest.java (limited to 'adapters/mso-catalog-db-adapter/src/test/java') diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryExceptionTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryExceptionTest.java new file mode 100644 index 0000000000..365c9abcf5 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryExceptionTest.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.openecomp.mso.adapters.catalogdb.catalogrest; + +import org.junit.Test; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertEquals; + +public class CatalogQueryExceptionTest { + @Test + public void catalogQueryExceptionConstructor(){ + CatalogQueryException messageCatalogQueryException = new CatalogQueryException("TestMessage"); + assertNotNull(messageCatalogQueryException.getMessage()); + assertEquals("TestMessage",messageCatalogQueryException.getMessage()); + + CatalogQueryException paramsCatalogQueryException = new CatalogQueryException("TestMessage",CatalogQueryExceptionCategory.INTERNAL,true,"messageID"); + assertParams(paramsCatalogQueryException); + + CatalogQueryException defaultCatalogQueryException = new CatalogQueryException(); + defaultCatalogQueryException.setCategory(CatalogQueryExceptionCategory.INTERNAL); + defaultCatalogQueryException.setMessage("TestMessage"); + defaultCatalogQueryException.setRolledBack(true); + defaultCatalogQueryException.setMessageId("messageID"); + assertParams(defaultCatalogQueryException); + } + + private void assertParams(CatalogQueryException paramsCatalogQueryException) { + assertNotNull(paramsCatalogQueryException.getMessage()); + assertEquals("TestMessage",paramsCatalogQueryException.getMessage()); + assertNotNull(paramsCatalogQueryException.getCategory()); + assertEquals(CatalogQueryExceptionCategory.INTERNAL,paramsCatalogQueryException.getCategory()); + assertNotNull(paramsCatalogQueryException.getRolledBack()); + assertEquals(true,paramsCatalogQueryException.getRolledBack()); + assertNotNull(paramsCatalogQueryException.getMessageId()); + assertEquals("messageID",paramsCatalogQueryException.getMessageId()); + } +} -- cgit 1.2.3-korg