summaryrefslogtreecommitdiffstats
path: root/mso-catalog-db/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'mso-catalog-db/src/test/java')
-rw-r--r--mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/CatalogDatabaseTest.java55
1 files changed, 52 insertions, 3 deletions
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 219e70ea87..2ec75d7582 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
@@ -1443,9 +1443,58 @@ public class CatalogDatabaseTest {
VnfResource vnf = cd.getVnfResourceById(19299);
}
- @Test(expected = Exception.class)
- public void getVfModuleModelNameTestException(){
- VfModule vnf = cd.getVfModuleModelName("tetes");
+ @Test
+ public void getVfModuleModelName(){
+ MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ @Mock
+ public List<VfModule> list() throws Exception {
+ VfModule vfModule = new VfModule();
+ vfModule.setModelUUID("123-uuid");
+ return Arrays.asList(vfModule);
+ }
+ };
+
+ MockUp<Session> mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ VfModule vfModule = cd.getVfModuleModelName("vfmodule");
+ assertEquals("123-uuid", vfModule.getModelUUID());
+ }
+
+ @Test
+ public void getVfModuleModelNameExceptionTest(){
+ MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ @Mock
+ public List<VfModule> list() throws Exception {
+ return Arrays.asList();
+ }
+ };
+
+ MockUp<Session> mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ VfModule vfModule = cd.getVfModuleModelName("vfmodule");
+ assertEquals(null, vfModule);
}
@Test(expected = Exception.class)