diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/CatalogDatabaseTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/CatalogDatabaseTest.java
index 42e440b..7e6a5da 100644
--- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/CatalogDatabaseTest.java
+++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/CatalogDatabaseTest.java
@@ -20,15 +20,28 @@
 
 package org.openecomp.mso.db.catalog.test;
 
-import mockit.Mock;
-import mockit.MockUp;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
 import org.hibernate.HibernateException;
 import org.hibernate.NonUniqueResultException;
 import org.hibernate.Query;
 import org.hibernate.Session;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Ignore;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.ExpectedException;
 import org.openecomp.mso.db.catalog.CatalogDatabase;
 import org.openecomp.mso.db.catalog.beans.AllottedResource;
 import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization;
@@ -53,26 +66,36 @@
 import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization;
 import org.openecomp.mso.db.catalog.utils.RecordNotFoundException;
 
-import java.io.Serializable;
-import java.util.*;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
+import mockit.Mock;
+import mockit.MockUp;
 
 public class CatalogDatabaseTest {
 
     CatalogDatabase cd = null;
-
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+    private MockUp<CatalogDatabase> mockCd = null;
+    private MockUp<Session> mockedSession = null;
+    private MockUp<Query> mockUpQuery = null;
     @Before
     public void setup(){
         cd = CatalogDatabase.getInstance();
     }
+    
+  
+	 @After
+	 public void tearDown() {
+		 if (mockCd!=null) { mockCd.tearDown(); mockCd = null; }
+		 if (mockedSession!=null) { mockedSession.tearDown(); mockedSession = null; }
+		 if (mockUpQuery!=null) { mockUpQuery.tearDown(); mockUpQuery = null; }
+    }
+
 
 
     @Test
     public void getAllHeatTemplatesTest(){
 
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
             @Mock
             public List<HeatTemplate> list() {
                 HeatTemplate heatTemplate = new HeatTemplate();
@@ -80,14 +103,14 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -96,12 +119,14 @@
 
         List <HeatTemplate> list = cd.getAllHeatTemplates();
         assertEquals(list.size(), 1);
+
+
     }
 
     @Test
     public void getHeatTemplateByIdTest(){
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Object get(Class cls, Serializable id) {
                 HeatTemplate heatTemplate = new HeatTemplate();
@@ -110,7 +135,7 @@
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -119,12 +144,14 @@
 
         HeatTemplate ht = cd.getHeatTemplate(10);
         assertEquals("123-uuid", ht.getAsdcUuid());
+
+
     }
 
     @Test
     public void getHeatTemplateByNameEmptyListTest(){
 
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
             @Mock
             public List<HeatTemplate> list() {
                 HeatTemplate heatTemplate = new HeatTemplate();
@@ -132,14 +159,14 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -148,12 +175,14 @@
 
         HeatTemplate ht = cd.getHeatTemplate("heat123");
         assertEquals(null, ht);
+
+
     }
 
     @Test
     public void getHeatTemplateByNameTest(){
 
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
             @Mock
             public List<HeatTemplate> list() {
                 HeatTemplate heatTemplate1 = new HeatTemplate();
@@ -166,14 +195,14 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -182,12 +211,14 @@
 
         HeatTemplate ht = cd.getHeatTemplate("heat123");
         assertEquals("456-uuid", ht.getAsdcUuid());
+
+
     }
 
     @Test
     public void getHeatTemplateByTemplateNameTest() {
 
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
             @Mock
             public List<HeatTemplate> list() {
                 HeatTemplate heatTemplate = new HeatTemplate();
@@ -196,14 +227,14 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -212,26 +243,28 @@
 
         HeatTemplate ht = cd.getHeatTemplate("heat123","v2");
         assertEquals("1234-uuid", ht.getAsdcUuid());
+
+
     }
 
     @Test
     public void getHeatTemplateByTemplateNameEmptyResultTest() {
 
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
             @Mock
             public List<HeatTemplate> list() {
                 return Arrays.asList();
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -240,12 +273,14 @@
 
         HeatTemplate ht = cd.getHeatTemplate("heat123","v2");
         assertEquals(null, ht);
+
+
     }
 
     @Test
     public void getHeatTemplateByArtifactUuidException(){
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Object get(Class cls, Serializable id) {
                 HeatTemplate heatTemplate = new HeatTemplate();
@@ -254,7 +289,7 @@
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -263,12 +298,14 @@
 
         HeatTemplate ht = cd.getHeatTemplateByArtifactUuid("123");
         assertEquals("123-uuid", ht.getAsdcUuid());
+
+
     }
 
     @Test
     public void getHeatTemplateByArtifactUuidTest(){
 
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() {
@@ -278,14 +315,14 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -294,12 +331,15 @@
 
         HeatTemplate ht = cd.getHeatTemplateByArtifactUuidRegularQuery("123-uuid");
         assertEquals("123-uuid", ht.getAsdcUuid());
+
+
     }
 
-    @Test(expected = HibernateException.class)
+    @Test
+    @Ignore
     public void getHeatTemplateByArtifactUuidHibernateErrorTest(){
 
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() {
@@ -307,27 +347,29 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
             }
         };
-
+        thrown.expect(HibernateException.class);
         HeatTemplate ht = cd.getHeatTemplateByArtifactUuidRegularQuery("123-uuid");
+
+
     }
 
-    @Test(expected = NonUniqueResultException.class)
+    @Test
     public void getHeatTemplateByArtifactUuidNonUniqueResultTest(){
 
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() {
@@ -335,27 +377,29 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
             }
         };
-
+        thrown.expect(NonUniqueResultException.class);
         HeatTemplate ht = cd.getHeatTemplateByArtifactUuidRegularQuery("123-uuid");
+
+
     }
 
-    @Test(expected = Exception.class)
+    @Test
     public void getHeatTemplateByArtifactUuidGenericExceptionTest(){
 
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() throws Exception {
@@ -363,27 +407,29 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
             }
         };
-
+        thrown.expect(Exception.class);
         HeatTemplate ht = cd.getHeatTemplateByArtifactUuidRegularQuery("123-uuid");
+
+
     }
 
     @Test
     public void getParametersForHeatTemplateTest(){
 
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
             @Mock
             public List<HeatTemplate> list() {
                 HeatTemplate heatTemplate = new HeatTemplate();
@@ -392,14 +438,14 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -408,66 +454,73 @@
 
         List<HeatTemplateParam> htList = cd.getParametersForHeatTemplate("12l3");
         assertEquals(1, htList.size());
+
+
     }
 
-    @Test(expected = HibernateException.class)
+    @Test
     public void getParametersForHeatTemplateHibernateExceptionTest(){
 
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
             @Mock
             public List<HeatTemplate> list() {
                 throw new HibernateException("hibernate exception");
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
             }
         };
-
+        thrown.expect(HibernateException.class);
         List<HeatTemplateParam> htList = cd.getParametersForHeatTemplate("12l3");
+  
+
+
     }
 
-    @Test(expected = Exception.class)
+    @Test
     public void getParametersForHeatTemplateExceptionTest(){
 
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
             @Mock
             public List<HeatTemplate> list() throws Exception {
                 throw new Exception();
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
             }
         };
-
+        thrown.expect(Exception.class);
         List<HeatTemplateParam> htList = cd.getParametersForHeatTemplate("12l3");
+
+
     }
 
     @Test
     public void getHeatEnvironmentByArtifactUuidTest(){
 
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() {
@@ -477,14 +530,14 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -493,12 +546,14 @@
 
         HeatEnvironment he = cd.getHeatEnvironmentByArtifactUuid("123");
         assertEquals("123-uuid", he.getArtifactUuid());
+
+
     }
 
-    @Test(expected = HibernateException.class)
+    @Test
     public void getHeatEnvironmentByArtifactUuidHibernateExceptionTest(){
 
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() {
@@ -506,27 +561,29 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
             }
         };
-
+        thrown.expect(HibernateException.class);
         HeatEnvironment he = cd.getHeatEnvironmentByArtifactUuid("123");
+
+
     }
 
-    @Test(expected = Exception.class)
+    @Test
     public void getHeatEnvironmentByArtifactUuidExceptionTest(){
 
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() throws Exception {
@@ -534,27 +591,29 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
             }
         };
-
+        thrown.expect(Exception.class);
         HeatEnvironment he = cd.getHeatEnvironmentByArtifactUuid("123");
+
+
     }
 
     @Test
     public void getServiceByInvariantUUIDTest(){
 
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public List<Service> list() {
@@ -564,14 +623,14 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -580,12 +639,14 @@
 
         Service service = cd.getServiceByInvariantUUID("123");
         assertEquals("123-uuid", service.getModelUUID());
+
+
     }
 
     @Test
     public void getServiceByInvariantUUIDEmptyResultTest(){
 
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public List<Service> list() {
@@ -593,14 +654,14 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -609,12 +670,14 @@
 
         Service service = cd.getServiceByInvariantUUID("123");
         assertEquals(null, service);
+
+
     }
 
     @Test
     public void getServiceTest(){
 
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() throws Exception {
@@ -624,14 +687,14 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -640,12 +703,14 @@
 
         Service service = cd.getService("123");
         assertEquals("123-uuid", service.getModelUUID());
+
+
     }
 
-    @Test(expected = NonUniqueResultException.class)
+    @Test
     public void getServiceNoUniqueResultTest(){
 
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() throws Exception {
@@ -653,27 +718,29 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
             }
         };
-
+        thrown.expect(NonUniqueResultException.class);
         Service service = cd.getService("123");
+
+
     }
 
-    @Test(expected = HibernateException.class)
+    @Test
     public void getServiceHibernateExceptionTest(){
 
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() throws Exception {
@@ -681,27 +748,29 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
             }
         };
-
+        thrown.expect(HibernateException.class);
         Service service = cd.getService("123");
+
+
     }
 
-    @Test(expected = Exception.class)
+    @Test
     public void getServiceExceptionTest(){
 
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() throws Exception {
@@ -709,27 +778,29 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
             }
         };
-
+        thrown.expect(Exception.class);
         Service service = cd.getService("123");
+
+
     }
 
     @Test
     public void getServiceByModelUUIDTest(){
 
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() throws Exception {
@@ -739,14 +810,14 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -754,11 +825,13 @@
         };
         Service service = cd.getServiceByModelUUID("123");
         assertEquals("123-uuid", service.getModelUUID());
+
+
     }
 
     @Test
     public void getService2Test(){
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() throws Exception {
@@ -768,14 +841,14 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -787,12 +860,14 @@
         Service service = cd.getService(map, "123");
 
         assertEquals("123-uuid", service.getModelUUID());
+
+
     }
 
     @Test
     public void getServiceByModelNameTest(){
 
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
             @Mock
             public List<Service> list() throws Exception {
                 Service service = new Service();
@@ -801,14 +876,14 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -817,26 +892,28 @@
 
         Service service = cd.getServiceByModelName("123");
         assertEquals("123-uuid", service.getModelUUID());
+
+
     }
 
     @Test
     public void getServiceByModelNameEmptyTest(){
 
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
             @Mock
             public List<Service> list() throws Exception {
                 return Arrays.asList();
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -845,12 +922,14 @@
 
         Service service = cd.getServiceByModelName("123");
         assertEquals(null, service);
+
+
     }
 
     @Test
     public void getServiceByVersionAndInvariantIdTest() throws Exception{
 
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() throws Exception {
@@ -860,14 +939,14 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -875,12 +954,14 @@
         };
         Service service = cd.getServiceByVersionAndInvariantId("123","tetwe");
         assertEquals("123-uuid", service.getModelUUID());
+
+
     }
 
-    @Test(expected = Exception.class)
+    @Test
     public void getServiceByVersionAndInvariantIdNonUniqueResultTest() throws Exception{
 
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() throws Exception {
@@ -888,30 +969,34 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
             }
         };
+        thrown.expect(Exception.class);
         Service service = cd.getServiceByVersionAndInvariantId("123","tetwe");
+
+
     }
 
-    @Test(expected = Exception.class)
+    @Test
     public void getServiceRecipeTestException() throws Exception{
+    	thrown.expect(Exception.class);
         ServiceRecipe ht = cd.getServiceRecipe("123","tetwe");
     }
 
     @Test
     public void getServiceRecipeByServiceModelUuidTest() {
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
             @Mock
             public List<ServiceRecipe> list() throws Exception {
                 ServiceRecipe serviceRecipe = new ServiceRecipe();
@@ -920,14 +1005,14 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -935,25 +1020,27 @@
         };
         ServiceRecipe serviceRecipe = cd.getServiceRecipeByServiceModelUuid("123","tetwe");
         assertEquals(1, serviceRecipe.getId());
+
+
     }
 
     @Test
     public void getServiceRecipeByServiceModelUuidEmptyTest() {
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
             @Mock
             public List<ServiceRecipe> list() throws Exception {
                 return Arrays.asList();
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -961,11 +1048,13 @@
         };
         ServiceRecipe serviceRecipe = cd.getServiceRecipeByServiceModelUuid("123","tetwe");
         assertEquals(null, serviceRecipe);
+
+
     }
 
     @Test
     public void getServiceRecipesTestException() throws Exception{
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
             @Mock
             public List<ServiceRecipe> list() {
                 ServiceRecipe serviceRecipe = new ServiceRecipe();
@@ -974,14 +1063,14 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -989,25 +1078,27 @@
         };
         List<ServiceRecipe> serviceRecipes = cd.getServiceRecipes("123");
         assertEquals(1, serviceRecipes.size());
+
+
     }
 
     @Test
     public void getServiceRecipesEmptyTest() throws Exception{
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
             @Mock
             public List<ServiceRecipe> list() {
                 return Arrays.asList();
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -1015,16 +1106,19 @@
         };
         List<ServiceRecipe> serviceRecipes = cd.getServiceRecipes("123");
         assertEquals(0, serviceRecipes.size());
+
+
     }
 
-    @Test(expected = Exception.class)
+    @Test
     public void getVnfComponentTestException() throws Exception{
+    	thrown.expect(Exception.class);
         VnfComponent ht = cd.getVnfComponent(123,"vnf");
     }
 
     @Test
     public void getVnfResourceTest() throws Exception{
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
             @Mock
             public List<VnfResource> list() {
                 VnfResource vnfResource = new VnfResource();
@@ -1033,14 +1127,14 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -1048,25 +1142,27 @@
         };
         VnfResource vnfResource = cd.getVnfResource("vnf");
         assertEquals("123-uuid", vnfResource.getModelUuid());
+
+
     }
 
     @Test
     public void getVnfResourceEmptyTest() throws Exception{
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
             @Mock
             public List<VnfResource> list() {
                 return Arrays.asList();
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -1074,11 +1170,13 @@
         };
         VnfResource vnfResource = cd.getVnfResource("vnf");
         assertEquals(null, vnfResource);
+
+
     }
 
     @Test
     public void getVnfResourceByTypeTest() {
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() {
@@ -1088,14 +1186,14 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -1103,11 +1201,13 @@
         };
         VnfResource vnfResource = cd.getVnfResource("vnf","3992");
         assertEquals("123-uuid", vnfResource.getModelUuid());
+
+
     }
 
-    @Test(expected = NonUniqueResultException.class)
+    @Test
     public void getVnfResourceNURExceptionTest() {
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() {
@@ -1115,25 +1215,28 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
             }
         };
+        thrown.expect(NonUniqueResultException.class);
         VnfResource vnfResource = cd.getVnfResource("vnf","3992");
+
+
     }
 
-    @Test(expected = HibernateException.class)
+    @Test
     public void getVnfResourceHibernateExceptionTest() {
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() {
@@ -1141,25 +1244,28 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
             }
         };
+        thrown.expect(HibernateException.class);
         VnfResource vnfResource = cd.getVnfResource("vnf","3992");
+
+
     }
 
-    @Test(expected = Exception.class)
+    @Test
     public void getVnfResourceExceptionTest() {
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() throws Exception {
@@ -1167,25 +1273,28 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
             }
         };
+        thrown.expect(Exception.class);
         VnfResource vnfResource = cd.getVnfResource("vnf","3992");
+
+
     }
 
     @Test
     public void getVnfResourceByModelCustomizationIdTest() {
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() throws Exception {
@@ -1195,14 +1304,14 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -1211,11 +1320,13 @@
 
         VnfResource vnfResource = cd.getVnfResourceByModelCustomizationId("3992");
         assertEquals("123-uuid",vnfResource.getModelUuid());
+
+
     }
 
-    @Test(expected = NonUniqueResultException.class)
+    @Test
     public void getVnfResourceByModelCustomizationIdNURExceptionTest() {
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() throws Exception {
@@ -1223,26 +1334,28 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
             }
         };
-
+        thrown.expect(NonUniqueResultException.class);
         VnfResource vnfResource = cd.getVnfResourceByModelCustomizationId("3992");
+
+
     }
 
-    @Test(expected = HibernateException.class)
+    @Test
     public void getVnfResourceByModelCustomizationIdHibernateExceptionTest() {
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() throws Exception {
@@ -1250,32 +1363,35 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
             }
         };
-
+        thrown.expect(HibernateException.class);
         VnfResource vnfResource = cd.getVnfResourceByModelCustomizationId("3992");
+
+
     }
 
 
-    @Test(expected = Exception.class)
+    @Test
     public void getServiceRecipeTest2Exception() throws Exception{
+    	thrown.expect(Exception.class);
         ServiceRecipe ht = cd.getServiceRecipe(1001,"3992");
     }
 
     @Test
     public void getVnfResourceCustomizationByModelCustomizationNameTest(){
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
             @Mock
             public List<VnfResourceCustomization> list() throws Exception {
                 VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
@@ -1284,14 +1400,14 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -1299,25 +1415,27 @@
         };
         VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelCustomizationName("test", "test234");
         assertEquals("123-uuid", vnf.getVnfResourceModelUUID());
+
+
     }
 
     @Test
     public void getVnfResourceCustomizationByModelCustomizationNameEmptyTest(){
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
             @Mock
             public List<VnfResourceCustomization> list() throws Exception {
                 return Arrays.asList();
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -1325,11 +1443,13 @@
         };
         VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelCustomizationName("test", "test234");
         assertEquals(null, vnf);
+
+
     }
 
     @Test
     public void getVnfResourceByModelInvariantIdTest(){
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult(){
@@ -1339,14 +1459,14 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -1354,11 +1474,13 @@
         };
         VnfResource vnf = cd.getVnfResourceByModelInvariantId("test", "test234");
         assertEquals("123-uuid", vnf.getModelUuid());
+
+
     }
 
-    @Test(expected = NonUniqueResultException.class)
+    @Test
     public void getVnfResourceByModelInvariantIdNURExceptionTest(){
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult(){
@@ -1366,25 +1488,28 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
             }
         };
+        thrown.expect(NonUniqueResultException.class);
         VnfResource vnf = cd.getVnfResourceByModelInvariantId("test", "test234");
+
+
     }
 
-    @Test(expected = HibernateException.class)
+    @Test
     public void getVnfResourceByModelInvariantIdHibernateExceptionTest(){
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult(){
@@ -1392,25 +1517,28 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
             }
         };
+        thrown.expect(HibernateException.class);
         VnfResource vnf = cd.getVnfResourceByModelInvariantId("test", "test234");
+
+
     }
 
-    @Test(expected = Exception.class)
+    @Test
     public void getVnfResourceByModelInvariantIdExceptionTest(){
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() throws Exception {
@@ -1418,31 +1546,34 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
             }
         };
+        thrown.expect(Exception.class);
         VnfResource vnf = cd.getVnfResourceByModelInvariantId("test", "test234");
+
+
     }
 
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getVnfResourceByIdTestException(){
+    	thrown.expect(Exception.class);
         VnfResource vnf = cd.getVnfResourceById(19299);
     }
 
     @Test
     public void getVfModuleModelName(){
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
             @Mock
             public List<VfModule> list() throws Exception {
                 VfModule vfModule = new VfModule();
@@ -1451,14 +1582,14 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -1466,25 +1597,27 @@
         };
         VfModule vfModule = cd.getVfModuleModelName("vfmodule");
         assertEquals("123-uuid", vfModule.getModelUUID());
+
+
     }
 
     @Test
     public void getVfModuleModelNameExceptionTest(){
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
             @Mock
             public List<VfModule> list() throws Exception {
                 return Arrays.asList();
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -1492,11 +1625,13 @@
         };
         VfModule vfModule = cd.getVfModuleModelName("vfmodule");
         assertEquals(null, vfModule);
+
+
     }
 
     @Test
     public void getVfModuleModelNameTest() {
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() {
@@ -1506,14 +1641,14 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -1522,11 +1657,13 @@
 
         VfModule vfModule = cd.getVfModuleModelName("tetes","4kidsl");
         assertEquals("123-uuid", vfModule.getModelUUID());
+
+
     }
 
-    @Test(expected = NonUniqueResultException.class)
+    @Test
     public void getVfModuleModelNameNURExceptionTest() {
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() {
@@ -1534,26 +1671,28 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
             }
         };
-
+        thrown.expect(NonUniqueResultException.class);
         VfModule vfModule = cd.getVfModuleModelName("tetes","4kidsl");
+
+
     }
 
-    @Test(expected = HibernateException.class)
+    @Test
     public void getVfModuleModelNameHibernateExceptionTest() {
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() {
@@ -1561,26 +1700,28 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
             }
         };
-
+        thrown.expect(HibernateException.class);
         VfModule vfModule = cd.getVfModuleModelName("tetes","4kidsl");
+
+
     }
 
-    @Test(expected = Exception.class)
+    @Test
     public void getVfModuleModelNameGenericExceptionTest() {
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() throws Exception {
@@ -1588,26 +1729,28 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
             }
         };
-
+        thrown.expect(Exception.class);
         VfModule vfModule = cd.getVfModuleModelName("tetes","4kidsl");
+
+
     }
 
     @Test
     public void ggetVfModuleCustomizationByModelNameTest(){
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
             @Mock
             public List<VfModuleCustomization> list() throws Exception {
                 VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
@@ -1616,14 +1759,14 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -1631,25 +1774,27 @@
         };
         VfModuleCustomization vfModuleCustomization = cd.getVfModuleCustomizationByModelName("tetes");
         assertEquals("123-uuid", vfModuleCustomization.getVfModuleModelUuid());
+
+
     }
 
     @Test
     public void ggetVfModuleCustomizationByModelNameEmptyTest(){
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
             @Mock
             public List<VfModuleCustomization> list() throws Exception {
                 return Arrays.asList();
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -1657,11 +1802,13 @@
         };
         VfModuleCustomization vfModuleCustomization = cd.getVfModuleCustomizationByModelName("tetes");
         assertEquals(null, vfModuleCustomization);
+
+
     }
 
     @Test
     public void getNetworkResourceTest(){
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
             @Mock
             public List<NetworkResource> list() throws Exception {
                 NetworkResource networkResource = new NetworkResource();
@@ -1670,14 +1817,14 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -1685,25 +1832,27 @@
         };
         NetworkResource networkResource = cd.getNetworkResource("tetes");
         assertEquals("123-uuid", networkResource.getModelUUID());
+
+
     }
 
     @Test
     public void getNetworkResourceTestEmptyException(){
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
             @Mock
             public List<NetworkResource> list() throws Exception {
                 return Arrays.asList();
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -1711,12 +1860,14 @@
         };
         NetworkResource networkResource = cd.getNetworkResource("tetes");
         assertEquals(null, networkResource);
+
+
     }
 
     @Test
     public void getVnfRecipeTest(){
 
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
             @Mock
             public List<VnfRecipe> list() throws Exception {
                 VnfRecipe vnfRecipe = new VnfRecipe();
@@ -1725,14 +1876,14 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -1741,26 +1892,28 @@
 
         VnfRecipe vnfRecipe = cd.getVnfRecipe("tetes","ergfedrf","4993493");
         assertEquals("123-id", vnfRecipe.getVfModuleId());
+
+
     }
 
     @Test
     public void getVnfRecipeEmptyTest(){
 
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
             @Mock
             public List<VnfRecipe> list() throws Exception {
                 return Collections.emptyList();
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -1769,11 +1922,13 @@
 
         VnfRecipe vnfRecipe = cd.getVnfRecipe("tetes","ergfedrf","4993493");
         assertEquals(null, vnfRecipe);
+
+
     }
 
     @Test
     public void getVnfRecipe2Test(){
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
             @Mock
             public List<VnfRecipe> list() throws Exception {
                 VnfRecipe vnfRecipe = new VnfRecipe();
@@ -1782,14 +1937,14 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -1797,25 +1952,27 @@
         };
         VnfRecipe vnfRecipe = cd.getVnfRecipe("tetes","4993493");
         assertEquals(1, vnfRecipe.getId());
+
+
     }
 
     @Test
     public void getVnfRecipe2EmptyTest(){
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
             @Mock
             public List<VnfRecipe> list() throws Exception {
                 return Collections.emptyList();
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -1823,11 +1980,13 @@
         };
         VnfRecipe vnfRecipe = cd.getVnfRecipe("tetes","4993493");
         assertEquals(null, vnfRecipe);
+
+
     }
 
     @Test
     public void getVnfRecipeByVfModuleIdTest(){
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
             @Mock
             public List<VnfRecipe> list() throws Exception {
                 VnfRecipe vnfRecipe = new VnfRecipe();
@@ -1836,14 +1995,14 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -1852,25 +2011,27 @@
 
         VnfRecipe vnfRecipe = cd.getVnfRecipeByVfModuleId("tetes","4993493","vnf");
         assertEquals(1, vnfRecipe.getId());
+
+
     }
 
     @Test
     public void getVnfRecipeByVfModuleIdEmptyTest(){
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
             @Mock
             public List<VnfRecipe> list() throws Exception {
                 return Collections.emptyList();
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -1879,21 +2040,24 @@
 
         VnfRecipe vnfRecipe = cd.getVnfRecipeByVfModuleId("tetes","4993493","vnf");
         assertEquals(null, vnfRecipe);
+
+
     }
 
-    @Test(expected = Exception.class)
+    @Test
     public void getVfModuleTypeTestException(){
+    	thrown.expect(Exception.class);
         VfModule vnf = cd.getVfModuleType("4993493");
     }
 
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getVfModuleType2TestException(){
+    	thrown.expect(Exception.class);
         VfModule vnf = cd.getVfModuleType("4993493","vnf");
     }
     @Test
     public void getVnfResourceByServiceUuidTest(){
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() {
@@ -1903,14 +2067,14 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -1918,11 +2082,13 @@
         };
         VnfResource vnfResource = cd.getVnfResourceByServiceUuid("4993493");
         assertEquals("123-uuid", vnfResource.getModelUuid());
+
+
     }
 
-    @Test(expected = NonUniqueResultException.class)
+    @Test
     public void getVnfResourceByServiceUuidNURExceptionTest(){
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() {
@@ -1930,25 +2096,28 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
             }
         };
+        thrown.expect(NonUniqueResultException.class);
         VnfResource vnfResource = cd.getVnfResourceByServiceUuid("4993493");
+
+
     }
 
-    @Test(expected = HibernateException.class)
+    @Test
     public void getVnfResourceByServiceUuidHibernateExceptionTest(){
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() {
@@ -1956,25 +2125,28 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
             }
         };
+        thrown.expect(HibernateException.class);
         VnfResource vnfResource = cd.getVnfResourceByServiceUuid("4993493");
+
+
     }
 
-    @Test(expected = Exception.class)
+    @Test
     public void getVnfResourceByServiceUuidExceptionTest(){
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() throws Exception {
@@ -1982,25 +2154,28 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
             }
         };
+        thrown.expect(Exception.class);
         VnfResource vnfResource = cd.getVnfResourceByServiceUuid("4993493");
+
+
     }
 
     @Test
     public void getVnfResourceByVnfUuidTest(){
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() {
@@ -2010,14 +2185,14 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -2026,11 +2201,13 @@
 
         VnfResource vnfResource = cd.getVnfResourceByVnfUuid("4993493");
         assertEquals("123-uuid", vnfResource.getModelUuid());
+
+
     }
 
-    @Test(expected = NonUniqueResultException.class)
+    @Test
     public void getVnfResourceByVnfUuidNURExceptionTest(){
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() {
@@ -2038,26 +2215,28 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
             }
         };
-
+        thrown.expect(NonUniqueResultException.class);
         VnfResource vnfResource = cd.getVnfResourceByVnfUuid("4993493");
+
+
     }
 
-    @Test(expected = HibernateException.class)
+    @Test
     public void getVnfResourceByVnfUuidHibernateExceptionTest(){
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() {
@@ -2065,26 +2244,28 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
             }
         };
-
+        thrown.expect(HibernateException.class);
         VnfResource vnfResource = cd.getVnfResourceByVnfUuid("4993493");
+
+
     }
 
-    @Test(expected = Exception.class)
+    @Test
     public void getVnfResourceByVnfUuidExceptionTest(){
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public Object uniqueResult() throws Exception {
@@ -2092,27 +2273,29 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
             }
         };
-
+        thrown.expect(Exception.class);
         VnfResource vnfResource = cd.getVnfResourceByVnfUuid("4993493");
+
+
     }
 
     @Test
     public void getVfModuleByModelInvariantUuidTest(){
 
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public List<VfModule> list() throws Exception {
@@ -2122,14 +2305,14 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -2138,12 +2321,14 @@
 
         VfModule vfModule = cd.getVfModuleByModelInvariantUuid("4993493");
         assertEquals("123-uuid", vfModule.getModelUUID());
+
+
     }
 
     @Test
     public void getVfModuleByModelInvariantUuidEmptyTest(){
 
-        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+        mockUpQuery = new MockUp<Query>() {
 
             @Mock
             public List<VfModule> list() throws Exception {
@@ -2151,14 +2336,14 @@
             }
         };
 
-        MockUp<Session> mockedSession = new MockUp<Session>() {
+        mockedSession = new MockUp<Session>() {
             @Mock
             public Query createQuery(String hql) {
                 return mockUpQuery.getMockInstance();
             }
         };
 
-        new MockUp<CatalogDatabase>() {
+        mockCd = new MockUp<CatalogDatabase>() {
             @Mock
             private Session getSession() {
                 return mockedSession.getMockInstance();
@@ -2167,95 +2352,125 @@
 
         VfModule vfModule = cd.getVfModuleByModelInvariantUuid("4993493");
         assertEquals(null, vfModule);
+
+
     }
 
-    @Test(expected = Exception.class)
+    @Test
     public void getVfModuleByModelCustomizationUuidTestException(){
+    	thrown.expect(Exception.class);
         VfModuleCustomization vnf = cd.getVfModuleByModelCustomizationUuid("4993493");
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getVfModuleByModelInvariantUuidAndModelVersionTestException(){
+    	thrown.expect(Exception.class);
         VfModule vnf = cd.getVfModuleByModelInvariantUuidAndModelVersion("4993493","vnf");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getVfModuleCustomizationByModelCustomizationIdTestException(){
+    	thrown.expect(Exception.class);
         VfModuleCustomization vnf = cd.getVfModuleCustomizationByModelCustomizationId("4993493");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getVfModuleByModelUuidTestException(){
+    	thrown.expect(Exception.class);
         VfModule vnf = cd.getVfModuleByModelUuid("4993493");
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getVnfResourceCustomizationByModelCustomizationUuidTestException(){
+    	thrown.expect(Exception.class);
         VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelCustomizationUuid("4993493");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getVnfResourceCustomizationByModelVersionIdTestException(){
+    	thrown.expect(Exception.class);
         VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelVersionId("4993493");
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getVfModuleByModelCustomizationIdAndVersionTestException(){
+    	thrown.expect(Exception.class);
         cd.getVfModuleByModelCustomizationIdAndVersion("4993493","test");
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getVfModuleByModelCustomizationIdModelVersionAndModelInvariantIdTestException(){
+    	thrown.expect(Exception.class);
         cd.getVfModuleByModelCustomizationIdModelVersionAndModelInvariantId("4993493","vnf","test");
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getVnfResourceCustomizationByModelInvariantIdTest(){
+    	thrown.expect(Exception.class);
         cd.getVnfResourceCustomizationByModelInvariantId("4993493","vnf","test");
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getVfModuleCustomizationByVnfModuleCustomizationUuidTest(){
-        cd.getVfModuleCustomizationByVnfModuleCustomizationUuid("4993493");
+    	mockUpQuery = new MockUp<Query>() {
+
+            @Mock
+            public List<VfModule> list() throws Exception {
+                return Collections.emptyList();
+            }
+        };
+
+        mockedSession = new MockUp<Session>() {
+            @Mock
+            public Query createQuery(String hql) {
+                return mockUpQuery.getMockInstance();
+            }
+        };
+
+        mockCd = new MockUp<CatalogDatabase>() {
+            @Mock
+            private Session getSession() {
+                return mockedSession.getMockInstance();
+            }
+        };
+        assertEquals(cd.getVfModuleCustomizationByVnfModuleCustomizationUuid("4993493").size(), 0);
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionIdTest(){
+    	thrown.expect(Exception.class);
         cd.getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionId("4993493","test");
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getAllVfModuleCustomizationstest(){
+    	thrown.expect(Exception.class);
         cd.getAllVfModuleCustomizations("4993493");
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getVnfResourceByModelUuidTest(){
+    	thrown.expect(Exception.class);
         cd.getVnfResourceByModelUuid("4993493");
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getVnfResCustomToVfModuleTest(){
+    	thrown.expect(Exception.class);
         cd.getVnfResCustomToVfModule("4993493","test");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getVfModulesForVnfResourceTest(){
         VnfResource vnfResource = new VnfResource();
         vnfResource.setModelUuid("48839");
+        thrown.expect(Exception.class);
         cd.getVfModulesForVnfResource(vnfResource);
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getVfModulesForVnfResource2Test(){
+    	thrown.expect(Exception.class);
         cd.getVfModulesForVnfResource("4993493");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getServiceByUuidTest(){
+    	thrown.expect(Exception.class);
         cd.getServiceByUuid("4993493");
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getNetworkResourceById2Test(){
+    	thrown.expect(Exception.class);
         cd.getNetworkResourceById(4993493);
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getNetworkResourceByIdTest(){
+    	thrown.expect(Exception.class);
         cd.getVfModuleTypeByUuid("4993493");
     }
     @Test
@@ -2263,384 +2478,529 @@
         boolean is = cd.isEmptyOrNull("4993493");
         assertFalse(is);
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getSTRTest(){
+    	thrown.expect(Exception.class);
         cd.getSTR("4993493","test","vnf");
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getVRCtoVFMCTest(){
-        cd.getVRCtoVFMC("4993493","388492");
+    	mockUpQuery = new MockUp<Query>() {
+
+            @Mock
+            public List<VfModule> list() throws Exception {
+                return Collections.emptyList();
+            }
+        };
+
+        mockedSession = new MockUp<Session>() {
+            @Mock
+            public Query createQuery(String hql) {
+                return mockUpQuery.getMockInstance();
+            }
+        };
+
+        mockCd = new MockUp<CatalogDatabase>() {
+            @Mock
+            private Session getSession() {
+                return mockedSession.getMockInstance();
+            }
+        };
+        assertEquals(cd.getVRCtoVFMC("4993493","388492").size(), 0);
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getVfModuleTypeByUuidTestException(){
+    	thrown.expect(Exception.class);
         cd.getVfModuleTypeByUuid("4993493");
     }
 
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getTempNetworkHeatTemplateLookupTest(){
+    	thrown.expect(Exception.class);
         cd.getTempNetworkHeatTemplateLookup("4993493");
     }
 
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getAllNetworksByServiceModelUuidTest(){
-        cd.getAllNetworksByServiceModelUuid("4993493");
+    	mockUpQuery = new MockUp<Query>() {
+
+            @Mock
+            public List<VfModule> list() throws Exception {
+                return Collections.emptyList();
+            }
+        };
+
+        mockedSession = new MockUp<Session>() {
+            @Mock
+            public Query createQuery(String hql) {
+                return mockUpQuery.getMockInstance();
+            }
+        };
+
+        mockCd = new MockUp<CatalogDatabase>() {
+            @Mock
+            private Session getSession() {
+                return mockedSession.getMockInstance();
+            }
+        };
+        assertEquals(cd.getAllNetworksByServiceModelUuid("4993493").size(), 0);
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getAllNetworksByServiceModelInvariantUuidTest(){
+    	thrown.expect(Exception.class);
         cd.getAllNetworksByServiceModelInvariantUuid("4993493");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getAllNetworksByServiceModelInvariantUuid2Test(){
+    	thrown.expect(Exception.class);
         cd.getAllNetworksByServiceModelInvariantUuid("4993493","test");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getAllNetworksByNetworkModelCustomizationUuidTest(){
+    	thrown.expect(Exception.class);
         cd.getAllNetworksByNetworkModelCustomizationUuid("4993493");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getAllNetworksByNetworkTypeTest(){
+    	thrown.expect(Exception.class);
         cd.getAllNetworksByNetworkType("4993493");
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getAllVfmcForVrcTest(){
         VnfResourceCustomization re = new VnfResourceCustomization();
         re.setModelCustomizationUuid("377483");
+        thrown.expect(Exception.class);
         cd.getAllVfmcForVrc(re);
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getAllVnfsByServiceModelUuidTest(){
+    	thrown.expect(Exception.class);
         cd.getAllVnfsByServiceModelUuid("4993493");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getAllVnfsByServiceModelInvariantUuidTest(){
+    	thrown.expect(Exception.class);
         cd.getAllVnfsByServiceModelInvariantUuid("4993493");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getAllVnfsByServiceModelInvariantUuid2Test(){
+    	thrown.expect(Exception.class);
         cd.getAllVnfsByServiceModelInvariantUuid("4993493","test");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getAllVnfsByServiceNameTest(){
+    	thrown.expect(Exception.class);
         cd.getAllVnfsByServiceName("4993493","test");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getAllVnfsByServiceName2Test(){
+    	thrown.expect(Exception.class);
         cd.getAllVnfsByServiceName("4993493");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getAllVnfsByVnfModelCustomizationUuidTest(){
+    	thrown.expect(Exception.class);
         cd.getAllVnfsByVnfModelCustomizationUuid("4993493");
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getAllAllottedResourcesByServiceModelUuidTest(){
+    	thrown.expect(Exception.class);
         cd.getAllAllottedResourcesByServiceModelUuid("4993493");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getAllAllottedResourcesByServiceModelInvariantUuidTest(){
+    	thrown.expect(Exception.class);
         cd.getAllAllottedResourcesByServiceModelInvariantUuid("4993493");
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getAllAllottedResourcesByServiceModelInvariantUuid2Test(){
+    	thrown.expect(Exception.class);
         cd.getAllAllottedResourcesByServiceModelInvariantUuid("4993493","test");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getAllAllottedResourcesByArModelCustomizationUuidTest(){
+    	thrown.expect(Exception.class);
         cd.getAllAllottedResourcesByArModelCustomizationUuid("4993493");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getAllottedResourceByModelUuidTest(){
+    	thrown.expect(Exception.class);
         cd.getAllottedResourceByModelUuid("4993493");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getAllResourcesByServiceModelUuidTest(){
+    	thrown.expect(Exception.class);
         cd.getAllResourcesByServiceModelUuid("4993493");
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getAllResourcesByServiceModelInvariantUuidTest(){
+    	thrown.expect(Exception.class);
         cd.getAllResourcesByServiceModelInvariantUuid("4993493");
     }
 
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getAllResourcesByServiceModelInvariantUuid2Test(){
+    	thrown.expect(Exception.class);
         cd.getAllResourcesByServiceModelInvariantUuid("4993493","test");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getSingleNetworkByModelCustomizationUuidTest(){
+    	thrown.expect(Exception.class);
         cd.getSingleNetworkByModelCustomizationUuid("4993493");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getSingleAllottedResourceByModelCustomizationUuidTest(){
+    	thrown.expect(Exception.class);
         cd.getSingleAllottedResourceByModelCustomizationUuid("4993493");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getVfModuleRecipeTest(){
+    	thrown.expect(Exception.class);
         cd.getVfModuleRecipe("4993493","test","get");
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getVfModuleTest(){
-        cd.getVfModule("4993493","test","get","v2","vnf");
+    	mockUpQuery = new MockUp<Query>() {
+
+            @Mock
+            public List<VfModule> list() throws Exception {
+                return Collections.emptyList();
+            }
+        };
+
+        mockedSession = new MockUp<Session>() {
+            @Mock
+            public Query createQuery(String hql) {
+                return mockUpQuery.getMockInstance();
+            }
+        };
+
+        mockCd = new MockUp<CatalogDatabase>() {
+            @Mock
+            private Session getSession() {
+                return mockedSession.getMockInstance();
+            }
+        };
+        assertEquals(cd.getVfModule("4993493","test","get","v2","vnf").size(), 0);
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getVnfComponentsRecipeTest(){
+    	thrown.expect(Exception.class);
         cd.getVnfComponentsRecipe("4993493","test","v2","vnf","get","3992");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getVnfComponentsRecipeByVfModuleTest(){
         List <VfModule> resultList = new ArrayList<>();
         VfModule m = new VfModule();
         resultList.add(m);
+        thrown.expect(Exception.class);
         cd.getVnfComponentsRecipeByVfModule(resultList,"4993493");
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getAllVnfResourcesTest(){
+    	thrown.expect(Exception.class);
         cd.getAllVnfResources();
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getVnfResourcesByRoleTest(){
+    	thrown.expect(Exception.class);
         cd.getVnfResourcesByRole("4993493");
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getVnfResourceCustomizationsByRoleTest(){
+    	thrown.expect(Exception.class);
         cd.getVnfResourceCustomizationsByRole("4993493");
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getAllNetworkResourcesTest(){
+    	thrown.expect(Exception.class);
         cd.getAllNetworkResources();
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getAllNetworkResourceCustomizationsTest(){
+    	thrown.expect(Exception.class);
         cd.getAllNetworkResourceCustomizations();
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getAllVfModulesTest(){
+    	thrown.expect(Exception.class);
         cd.getAllVfModules();
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getAllVfModuleCustomizationsTest(){
+    	thrown.expect(Exception.class);
         cd.getAllVfModuleCustomizations();
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getAllHeatEnvironmentTest(){
-        cd.getAllHeatEnvironment();
+    	mockUpQuery = new MockUp<Query>() {
+
+            @Mock
+            public List<VfModule> list() throws Exception {
+                return Collections.emptyList();
+            }
+        };
+
+        mockedSession = new MockUp<Session>() {
+            @Mock
+            public Query createQuery(String hql) {
+                return mockUpQuery.getMockInstance();
+            }
+        };
+
+        mockCd = new MockUp<CatalogDatabase>() {
+            @Mock
+            private Session getSession() {
+                return mockedSession.getMockInstance();
+            }
+        };
+        assertEquals(cd.getAllHeatEnvironment().size(), 0);
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getHeatEnvironment2Test(){
+    	thrown.expect(Exception.class);
         cd.getHeatEnvironment(4993493);
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getNestedTemplatesTest(){
+    	thrown.expect(Exception.class);
         cd.getNestedTemplates(4993493);
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getNestedTemplates2Test(){
+    	thrown.expect(Exception.class);
         cd.getNestedTemplates("4993493");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getHeatFilesTest(){
+    	thrown.expect(Exception.class);
         cd.getHeatFiles(4993493);
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getVfModuleToHeatFilesEntryTest(){
+    	thrown.expect(Exception.class);
         cd.getVfModuleToHeatFilesEntry("4993493","49959499");
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getServiceToResourceCustomization(){
+    	thrown.expect(Exception.class);
         cd.getServiceToResourceCustomization("4993493","599349","49900");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getHeatFilesForVfModuleTest(){
+    	thrown.expect(Exception.class);
         cd.getHeatFilesForVfModule("4993493");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getHeatTemplateTest(){
+    	thrown.expect(Exception.class);
         cd.getHeatTemplate("4993493","test","heat");
     }
 
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void saveHeatTemplateTest(){
         HeatTemplate heat = new HeatTemplate();
         Set <HeatTemplateParam> paramSet = new HashSet<>();
+        thrown.expect(Exception.class);
         cd.saveHeatTemplate(heat,paramSet);
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getHeatEnvironmentTest(){
-        cd.getHeatEnvironment("4993493","test","heat");
+    	
+    	mockUpQuery = new MockUp<Query>() {
+
+            @Mock
+            public Object uniqueResult() throws Exception {
+                return null;
+            }
+        };
+
+        mockedSession = new MockUp<Session>() {
+            @Mock
+            public Query createQuery(String hql) {
+                return mockUpQuery.getMockInstance();
+            }
+        };
+
+        mockCd = new MockUp<CatalogDatabase>() {
+            @Mock
+            private Session getSession() {
+                return mockedSession.getMockInstance();
+            }
+        };
+        assertEquals(cd.getHeatEnvironment("4993493","test","heat"), null);
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getHeatEnvironment3Test(){
+    	thrown.expect(Exception.class);
         cd.getHeatEnvironment("4993493","test");
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void saveHeatEnvironmentTest(){
         HeatEnvironment en = new HeatEnvironment();
+        thrown.expect(Exception.class);
         cd.saveHeatEnvironment(en);
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void saveHeatTemplate2Test(){
         HeatTemplate heat = new HeatTemplate();
+        thrown.expect(Exception.class);
         cd.saveHeatTemplate(heat);
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void saveHeatFileTest(){
         HeatFiles hf = new HeatFiles();
+        thrown.expect(Exception.class);
         cd.saveHeatFile(hf);
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void saveVnfRecipeTest(){
         VnfRecipe vr = new VnfRecipe();
+        thrown.expect(Exception.class);
         cd.saveVnfRecipe(vr);
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void saveVnfComponentsRecipe(){
         VnfComponentsRecipe vr = new VnfComponentsRecipe();
+        thrown.expect(Exception.class);
         cd.saveVnfComponentsRecipe(vr);
     }
-    @Test(expected = Exception.class)
+    @Test
     public void saveOrUpdateVnfResourceTest(){
         VnfResource vr = new VnfResource();
+        thrown.expect(Exception.class);
         cd.saveOrUpdateVnfResource(vr);
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void saveVnfResourceCustomizationTest(){
         VnfResourceCustomization vr = new VnfResourceCustomization();
+        thrown.expect(Exception.class);
         cd.saveVnfResourceCustomization(vr);
     }
-    @Test(expected = Exception.class)
+    @Test
     public void saveAllottedResourceCustomizationTest(){
         AllottedResourceCustomization arc = new AllottedResourceCustomization();
+        thrown.expect(Exception.class);
         cd.saveAllottedResourceCustomization(arc);
     }
-    @Test(expected = Exception.class)
+    @Test
     public void saveAllottedResourceTest(){
         AllottedResource ar = new AllottedResource();
+        thrown.expect(Exception.class);
         cd.saveAllottedResource(ar);
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void saveNetworkResourceTest() throws RecordNotFoundException {
         NetworkResource nr = new NetworkResource();
+        thrown.expect(Exception.class);
         cd.saveNetworkResource(nr);
     }
-    @Test(expected = Exception.class)
+    @Test
     public void saveToscaCsarTest()throws RecordNotFoundException {
         ToscaCsar ts = new ToscaCsar();
+        thrown.expect(Exception.class);
         cd.saveToscaCsar(ts);
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getToscaCsar(){
+    	thrown.expect(Exception.class);
         cd.getToscaCsar("4993493");
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void saveTempNetworkHeatTemplateLookupTest(){
         TempNetworkHeatTemplateLookup t = new TempNetworkHeatTemplateLookup();
+        thrown.expect(Exception.class);
         cd.saveTempNetworkHeatTemplateLookup(t);
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void saveVfModuleToHeatFiles(){
         VfModuleToHeatFiles v = new VfModuleToHeatFiles();
+        thrown.expect(Exception.class);
         cd.saveVfModuleToHeatFiles(v);
     }
-    @Test(expected = Exception.class)
+    @Test
     public void saveVnfResourceToVfModuleCustomizationTest() throws RecordNotFoundException {
         VnfResourceCustomization v =new VnfResourceCustomization();
         VfModuleCustomization vm = new VfModuleCustomization();
+        thrown.expect(Exception.class);
         cd.saveVnfResourceToVfModuleCustomization(v, vm);
     }
-    @Test(expected = Exception.class)
+    @Test
     public void saveNetworkResourceCustomizationTest() throws RecordNotFoundException {
         NetworkResourceCustomization nrc = new NetworkResourceCustomization();
+        thrown.expect(Exception.class);
         cd.saveNetworkResourceCustomization(nrc);
     }
 
-    @Test(expected = Exception.class)
+    @Test
     public void saveServiceToNetworksTest(){
         AllottedResource ar = new AllottedResource();
+        thrown.expect(Exception.class);
         cd.saveAllottedResource(ar);
     }
-    @Test(expected = Exception.class)
+    @Test
     public void saveServiceToResourceCustomizationTest(){
         ServiceToResourceCustomization ar = new ServiceToResourceCustomization();
+        thrown.expect(Exception.class);
         cd.saveServiceToResourceCustomization(ar);
     }
-    @Test(expected = Exception.class)
+    @Test
     public void saveServiceTest(){
         Service ar = new Service();
+        thrown.expect(Exception.class);
         cd.saveService(ar);
     }
-    @Test(expected = Exception.class)
+    @Test
     public void saveOrUpdateVfModuleTest(){
         VfModule ar = new VfModule();
+        thrown.expect(Exception.class);
         cd.saveOrUpdateVfModule(ar);
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void saveOrUpdateVfModuleCustomizationTest(){
         VfModuleCustomization ar = new VfModuleCustomization();
+        thrown.expect(Exception.class);
         cd.saveOrUpdateVfModuleCustomization(ar);
     }
 
-    @Test(expected = Exception.class)
+    @Test
     public void getNestedHeatTemplateTest(){
+    	thrown.expect(Exception.class);
         cd.getNestedHeatTemplate(101,201);
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getNestedHeatTemplate2Test(){
+    	thrown.expect(Exception.class);
         cd.getNestedHeatTemplate("1002","1002");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void saveNestedHeatTemplateTest(){
         HeatTemplate ar = new HeatTemplate();
+        thrown.expect(Exception.class);
         cd.saveNestedHeatTemplate("1001",ar,"test");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getHeatFiles2Test(){
         VfModuleCustomization ar = new VfModuleCustomization();
+        thrown.expect(Exception.class);
         cd.getHeatFiles(101,"test","1001","v2");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getHeatFiles3Test(){
         VfModuleCustomization ar = new VfModuleCustomization();
+        thrown.expect(Exception.class);
         cd.getHeatFiles("200192");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void saveHeatFilesTest(){
         HeatFiles ar = new HeatFiles();
+        thrown.expect(Exception.class);
         cd.saveHeatFiles(ar);
     }
-    @Test(expected = Exception.class)
+    @Test
     public void saveVfModuleToHeatFilesTest(){
         HeatFiles ar = new HeatFiles();
+        thrown.expect(Exception.class);
         cd.saveVfModuleToHeatFiles("3772893",ar);
     }
     @Test
@@ -2648,14 +3008,14 @@
 
         cd.getNetworkResourceByModelUuid("3899291");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getNetworkRecipeTest(){
-
+    	thrown.expect(Exception.class);
         cd.getNetworkRecipe("test","test1","test2");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getNetworkRecipe2Test(){
-
+    	thrown.expect(Exception.class);
         cd.getNetworkRecipe("test","test1");
     }
     @Test
@@ -2663,66 +3023,64 @@
 
         cd.getNetworkResourceByModelCustUuid("test");
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getVnfComponentsRecipe2Test(){
-
+    	thrown.expect(Exception.class);
         cd.getVnfComponentsRecipe("test1","test2","test3","test4");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getVnfComponentsRecipeByVfModuleModelUUIdTest(){
-
+    	thrown.expect(Exception.class);
         cd.getVnfComponentsRecipeByVfModuleModelUUId("test1","test2","test3");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getVnfComponentRecipesTest(){
-
+    	thrown.expect(Exception.class);
         cd.getVnfComponentRecipes("test");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void saveOrUpdateVnfComponentTest(){
         VnfComponent ar = new VnfComponent();
+        thrown.expect(Exception.class);
         cd.saveOrUpdateVnfComponent(ar);
     }
 
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getVfModule2Test(){
-
+    	thrown.expect(Exception.class);
         cd.getVfModule("test");
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void getVfModuleByModelUUIDTest(){
-
+    	thrown.expect(Exception.class);
         cd.getVfModuleByModelUUID("test");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getServiceRecipeByModelUUIDTest(){
-
+    	thrown.expect(Exception.class);
         cd.getServiceRecipeByModelUUID("test1","test2");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void getModelRecipeTest(){
-
+    	thrown.expect(Exception.class);
         cd.getModelRecipe("test1","test2","test3");
     }
-    @Test(expected = Exception.class)
+    @Test
     public void healthCheck(){
-
+    	thrown.expect(Exception.class);
         cd.healthCheck();
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void executeQuerySingleRow(){
         VnfComponent ar = new VnfComponent();
         HashMap<String, String> variables = new HashMap<>();
+        thrown.expect(Exception.class);
         cd.executeQuerySingleRow("tets",variables,false);
     }
-    @Test(expected = Exception.class)
-    @Ignore // 1802 merge
+    @Test
     public void executeQueryMultipleRows(){
         HashMap<String, String> variables = new HashMap<>();
+        thrown.expect(Exception.class);
         cd.executeQueryMultipleRows("select",variables,false);
     }
 }
