0e7e1d67d4c5f0516ca3dec6715389dc9afeae9f
[openflowplugin.git] / extension / openflowplugin-extension-nicira / src / test / java / org / opendaylight / openflowplugin / extension / vendor / nicira / convertor / MatchUtilTest.java
1 package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor;
2
3 import static org.junit.Assert.assertEquals;
4
5 import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.MatchUtil;
6
7 import org.junit.Test;
8 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
9
10 public class MatchUtilTest {
11
12     private static final Ipv4Address IPV4_ADDRESS = new Ipv4Address("1.2.3.4");
13     private static final Long IPV4_LONG = new Long(16909060L);
14
15     @Test
16     public void testIpv4toLong() {
17         final Long result = MatchUtil.ipv4ToLong(IPV4_ADDRESS);
18         assertEquals("Does not match",IPV4_LONG,result);
19     }
20
21     @Test
22     public void testLongtoIpv4() {
23         Ipv4Address result = MatchUtil.longToIpv4Address(16909060L);
24         assertEquals("Does not match",IPV4_ADDRESS,result);
25     }
26
27 }