add junit coverage for HeatBridgeUtils
[so.git] / adapters / mso-openstack-adapters / src / test / java / org / onap / so / heatbridge / utils / HeatBridgeUtilsTest.java
1 package org.onap.so.heatbridge.utils;
2
3 import static org.assertj.core.api.Assertions.assertThat;
4 import java.util.Optional;
5 import org.junit.Test;
6
7 public class HeatBridgeUtilsTest {
8
9     @Test(expected = IllegalStateException.class)
10     public void matchServerName_canNotBeNull() {
11         HeatBridgeUtils.getMatchingPserverPifName(null);
12     }
13
14     @Test
15     public void matchServerName_isDedicated() {
16         Optional<String> serverName = HeatBridgeUtils.getMatchingPserverPifName("dedicated-testServer");
17         assertThat(serverName).isNotEmpty().hasValue("sriov-d-testServer");
18     }
19
20     @Test
21     public void matchServerName_isShared() {
22         Optional<String> serverName = HeatBridgeUtils.getMatchingPserverPifName("shared-testServer");
23         assertThat(serverName).isNotEmpty().hasValue("sriov-s-testServer");
24     }
25
26     @Test
27     public void matchServerName_unknown() {
28         Optional<String> serverName = HeatBridgeUtils.getMatchingPserverPifName("differentServerName");
29         assertThat(serverName).isEmpty();
30     }
31 }