Committed by
Gerrit Code Review
Remove InetAddress.getLocalHost() calls from OSPF tests.
This is an external dependency because it relies on DNS resolving localhost. Change-Id: I1f8aa481b2173a166334c8a7bffb60647c666e12
Showing
2 changed files
with
10 additions
and
12 deletions
... | @@ -21,7 +21,6 @@ import org.junit.Test; | ... | @@ -21,7 +21,6 @@ import org.junit.Test; |
21 | import org.onlab.packet.Ip4Address; | 21 | import org.onlab.packet.Ip4Address; |
22 | import org.onlab.packet.Ip6Address; | 22 | import org.onlab.packet.Ip6Address; |
23 | 23 | ||
24 | -import java.net.InetAddress; | ||
25 | import java.util.ArrayList; | 24 | import java.util.ArrayList; |
26 | import java.util.List; | 25 | import java.util.List; |
27 | 26 | ||
... | @@ -127,10 +126,10 @@ public class OspfDeviceTedImplTest { | ... | @@ -127,10 +126,10 @@ public class OspfDeviceTedImplTest { |
127 | /** | 126 | /** |
128 | * Tests ipv6RouterIds() getter method. | 127 | * Tests ipv6RouterIds() getter method. |
129 | */ | 128 | */ |
130 | - @Test(expected = Exception.class) | 129 | + @Test |
131 | public void testIpv6RouterIds() throws Exception { | 130 | public void testIpv6RouterIds() throws Exception { |
132 | List list = new ArrayList(); | 131 | List list = new ArrayList(); |
133 | - list.add(Ip6Address.valueOf(InetAddress.getLocalHost())); | 132 | + list.add(Ip6Address.valueOf(1)); |
134 | ospfDeviceTed.setIpv6RouterIds(list); | 133 | ospfDeviceTed.setIpv6RouterIds(list); |
135 | assertThat(ospfDeviceTed.ipv6RouterIds().size(), is(1)); | 134 | assertThat(ospfDeviceTed.ipv6RouterIds().size(), is(1)); |
136 | } | 135 | } |
... | @@ -138,11 +137,11 @@ public class OspfDeviceTedImplTest { | ... | @@ -138,11 +137,11 @@ public class OspfDeviceTedImplTest { |
138 | /** | 137 | /** |
139 | * Tests ipv6RouterIds() setter method. | 138 | * Tests ipv6RouterIds() setter method. |
140 | */ | 139 | */ |
141 | - @Test(expected = Exception.class) | 140 | + @Test |
142 | public void testSetIpv6RouterIds() throws Exception { | 141 | public void testSetIpv6RouterIds() throws Exception { |
143 | List list = new ArrayList(); | 142 | List list = new ArrayList(); |
144 | - list.add(Ip6Address.valueOf(InetAddress.getLocalHost())); | 143 | + list.add(Ip6Address.valueOf(1)); |
145 | ospfDeviceTed.setIpv6RouterIds(list); | 144 | ospfDeviceTed.setIpv6RouterIds(list); |
146 | assertThat(ospfDeviceTed.ipv6RouterIds().size(), is(1)); | 145 | assertThat(ospfDeviceTed.ipv6RouterIds().size(), is(1)); |
147 | } | 146 | } |
148 | -} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
147 | +} | ... | ... |
... | @@ -21,7 +21,6 @@ import org.junit.Test; | ... | @@ -21,7 +21,6 @@ import org.junit.Test; |
21 | import org.onlab.packet.Ip4Address; | 21 | import org.onlab.packet.Ip4Address; |
22 | import org.onlab.util.Bandwidth; | 22 | import org.onlab.util.Bandwidth; |
23 | 23 | ||
24 | -import java.net.InetAddress; | ||
25 | import java.util.ArrayList; | 24 | import java.util.ArrayList; |
26 | import java.util.List; | 25 | import java.util.List; |
27 | 26 | ||
... | @@ -90,7 +89,7 @@ public class OspfLinkTedImplTest { | ... | @@ -90,7 +89,7 @@ public class OspfLinkTedImplTest { |
90 | @Test | 89 | @Test |
91 | public void testIpv4RemRouterId() throws Exception { | 90 | public void testIpv4RemRouterId() throws Exception { |
92 | List list = new ArrayList(); | 91 | List list = new ArrayList(); |
93 | - list.add(Ip4Address.valueOf(InetAddress.getLocalHost())); | 92 | + list.add(Ip4Address.valueOf(1)); |
94 | ospfLinkTed.setIpv4RemRouterId(list); | 93 | ospfLinkTed.setIpv4RemRouterId(list); |
95 | assertThat(ospfLinkTed.ipv4RemRouterId().size(), is(1)); | 94 | assertThat(ospfLinkTed.ipv4RemRouterId().size(), is(1)); |
96 | } | 95 | } |
... | @@ -101,7 +100,7 @@ public class OspfLinkTedImplTest { | ... | @@ -101,7 +100,7 @@ public class OspfLinkTedImplTest { |
101 | @Test | 100 | @Test |
102 | public void testSetIpv4RemRouterId() throws Exception { | 101 | public void testSetIpv4RemRouterId() throws Exception { |
103 | List list = new ArrayList(); | 102 | List list = new ArrayList(); |
104 | - list.add(Ip4Address.valueOf(InetAddress.getLocalHost())); | 103 | + list.add(Ip4Address.valueOf(1)); |
105 | ospfLinkTed.setIpv4RemRouterId(list); | 104 | ospfLinkTed.setIpv4RemRouterId(list); |
106 | assertThat(ospfLinkTed.ipv4RemRouterId().size(), is(1)); | 105 | assertThat(ospfLinkTed.ipv4RemRouterId().size(), is(1)); |
107 | } | 106 | } |
... | @@ -132,7 +131,7 @@ public class OspfLinkTedImplTest { | ... | @@ -132,7 +131,7 @@ public class OspfLinkTedImplTest { |
132 | @Test | 131 | @Test |
133 | public void testIpv4LocRouterId() throws Exception { | 132 | public void testIpv4LocRouterId() throws Exception { |
134 | List list = new ArrayList(); | 133 | List list = new ArrayList(); |
135 | - list.add(Ip4Address.valueOf(InetAddress.getLocalHost())); | 134 | + list.add(Ip4Address.valueOf(1)); |
136 | ospfLinkTed.setIpv4LocRouterId(list); | 135 | ospfLinkTed.setIpv4LocRouterId(list); |
137 | assertThat(ospfLinkTed.ipv4LocRouterId().size(), is(1)); | 136 | assertThat(ospfLinkTed.ipv4LocRouterId().size(), is(1)); |
138 | } | 137 | } |
... | @@ -143,7 +142,7 @@ public class OspfLinkTedImplTest { | ... | @@ -143,7 +142,7 @@ public class OspfLinkTedImplTest { |
143 | @Test | 142 | @Test |
144 | public void testSetIpv4LocRouterId() throws Exception { | 143 | public void testSetIpv4LocRouterId() throws Exception { |
145 | List list = new ArrayList(); | 144 | List list = new ArrayList(); |
146 | - list.add(Ip4Address.valueOf(InetAddress.getLocalHost())); | 145 | + list.add(Ip4Address.valueOf(1)); |
147 | ospfLinkTed.setIpv4LocRouterId(list); | 146 | ospfLinkTed.setIpv4LocRouterId(list); |
148 | assertThat(ospfLinkTed.ipv4LocRouterId().size(), is(1)); | 147 | assertThat(ospfLinkTed.ipv4LocRouterId().size(), is(1)); |
149 | } | 148 | } |
... | @@ -201,4 +200,4 @@ public class OspfLinkTedImplTest { | ... | @@ -201,4 +200,4 @@ public class OspfLinkTedImplTest { |
201 | ospfLinkTed.setMaxUnResBandwidth(Bandwidth.bps(1234.0)); | 200 | ospfLinkTed.setMaxUnResBandwidth(Bandwidth.bps(1234.0)); |
202 | assertThat(ospfLinkTed.maxUnResBandwidth(), is(notNullValue())); | 201 | assertThat(ospfLinkTed.maxUnResBandwidth(), is(notNullValue())); |
203 | } | 202 | } |
204 | -} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
203 | +} | ... | ... |
-
Please register or login to post a comment