summaryrefslogtreecommitdiffstats
path: root/adapters/mso-adapter-utils/src/test/java
diff options
context:
space:
mode:
authorTomasz Gwozdecki <tomasz.gwozdecki@nokia.com>2019-01-10 03:08:59 -0500
committerLukasz Muszkieta <lukasz.muszkieta@nokia.com>2019-01-11 15:02:59 +0000
commitde5958dddd97b086ec8b603974f434fd814386ac (patch)
treeee987bc90ecebeb3e236ce89b9d9e929f7349497 /adapters/mso-adapter-utils/src/test/java
parent0f968235ec471225bb47be7268c73e845601c826 (diff)
junits for MsoTenantUtilsFactory
-Added new test for MsoTenantUtilsFactory Change-Id: I9ba756a1f1c569dc7d0c1528272cca1ccfe3aad4 Issue-ID: SO-1339 Signed-off-by: Tomasz Gwozdecki <tomasz.gwozdecki@nokia.com>
Diffstat (limited to 'adapters/mso-adapter-utils/src/test/java')
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoTenantUtilsFactoryTest.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoTenantUtilsFactoryTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoTenantUtilsFactoryTest.java
index fa4c6bfe6f..0ef54a07e8 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoTenantUtilsFactoryTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoTenantUtilsFactoryTest.java
@@ -3,6 +3,8 @@ package org.onap.so.openstack.utils;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.catchThrowableOfType;
import static org.mockito.BDDMockito.given;
+import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
+import static org.mockito.Mockito.mock;
import java.util.Optional;
import org.junit.Test;
@@ -11,6 +13,7 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.cloud.CloudConfig;
+import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
@RunWith(MockitoJUnitRunner.class)
@@ -35,4 +38,17 @@ public class MsoTenantUtilsFactoryTest {
assertThat(msoCloudSiteNotFound.getMessage()).contains(cloudSiteId);
}
+ @Test
+ public void getTenantUtils_shouldReturnNull_forInvalidServerType() throws MsoCloudSiteNotFound {
+ // GIVEN
+ String cloudSiteId = "CloudSiteId";
+ CloudSite cloudSite = mock(CloudSite.class, RETURNS_DEEP_STUBS);
+ given(cloudConfig.getCloudSite(cloudSiteId)).willReturn(Optional.of(cloudSite));
+
+ // WHEN
+ MsoTenantUtils tenantUtils = msoTenantUtilsFactory.getTenantUtils(cloudSiteId);
+
+ // THEN
+ assertThat(tenantUtils).isNull();
+ }
} \ No newline at end of file