junits for MsoTenantUtilsFactory
-Added new test for MsoTenantUtilsFactory
Change-Id: I9ba756a1f1c569dc7d0c1528272cca1ccfe3aad4
Issue-ID: SO-1339
Signed-off-by: Tomasz Gwozdecki <tomasz.gwozdecki@nokia.com>
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 fa4c6bf..0ef54a0 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 @@
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.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 @@
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