72046496f4e1c9f0bc19670d4c0443e314826263
[openflowjava.git] / third-party / openflow-codec / src / test / java / org / openflow / codec / protocol / OFPTypeTest.java
1 package org.openflow.codec.protocol;
2
3 import junit.framework.TestCase;
4
5 import org.junit.Test;
6 import org.openflow.codec.protocol.OFPHello;
7 import org.openflow.codec.protocol.OFPMessage;
8 import org.openflow.codec.protocol.OFPType;
9
10 public class OFPTypeTest extends TestCase {
11
12     public void testOFTypeCreate() throws Exception {
13         OFPType foo = OFPType.HELLO;
14         Class<? extends OFPMessage> c = foo.toClass();
15         TestCase.assertEquals(c, OFPHello.class);
16     }
17
18     @Test
19     public void testMapping() throws Exception {
20         TestCase.assertEquals(OFPType.HELLO, OFPType.valueOf((byte) 0));
21         TestCase.assertEquals(OFPType.BARRIER_REPLY, OFPType.valueOf((byte) 21));
22     }
23 }