summaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
authorRob Daugherty <rd472p@att.com>2018-03-28 01:34:55 +0000
committerGerrit Code Review <gerrit@onap.org>2018-03-28 01:34:55 +0000
commit1a229bd5f9469ea6aba7e638b20509fa6a56aa0c (patch)
tree9fdd4e70936fa7d2cc3d2db3c3c3ea64c6741667 /adapters
parentb5723530e99da12b7dc5004ca4de2d7bd85deef1 (diff)
parent3bfa426f9594bfd4976012a65ac9c27088c86f12 (diff)
Merge "Adding Junits for catalog db"
Diffstat (limited to 'adapters')
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryExceptionTest.java55
1 files changed, 55 insertions, 0 deletions
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());
+ }
+}