blob: 25fc9431eb1f49063cc24a258e9ca19fd3105f1e [file] [log] [blame]
Gregor Maier1ff55972013-12-11 02:22:56 -08001package org.projectfloodlight.openflow.types;
2
3import static org.junit.Assert.*;
4
5import org.junit.Test;
6
7/**
8 * Most tests are in IPv4AddressTest and IPv6AddressTest
9 * Just exception testing here
10 * @author gregor
11 *
12 */
13public class IPAddressTest {
14 @Test
15 public void testOfException() {
16 try {
17 IPAddress.of("Foobar");
18 fail("Should have thrown IllegalArgumentException");
19 } catch (IllegalArgumentException e) {
20 // expected
21 }
22 try {
23 IPAddressWithMask.of("Foobar");
24 fail("Should have thrown IllegalArgumentException");
25 } catch (IllegalArgumentException e) {
26 // expected
27 }
28 try {
29 IPAddress.of(null);
30 fail("Should have thrown NullPointerException");
31 } catch (NullPointerException e) {
32 assertNotNull(e.getMessage());
33 }
34 try {
35 IPAddressWithMask.of(null);
36 fail("Should have thrown NullPointerException");
37 } catch (NullPointerException e) {
38 assertNotNull(e.getMessage());
39 }
40 try {
41 IPAddress.of(null);
42 fail("Should have thrown NullPointerException");
43 } catch (NullPointerException e) {
44 assertNotNull(e.getMessage());
45 }
46 try {
47 IPAddressWithMask.of(null);
48 fail("Should have thrown NullPointerException");
49 } catch (NullPointerException e) {
50 assertNotNull(e.getMessage());
51 }
52 }
53
54}