diff options
Diffstat (limited to 'adapters/mso-adapter-utils/src/test/java/org')
-rw-r--r-- | adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoTenantUtilsFactoryTest.java | 16 |
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 |