Cleanup framing mechanisms
[controller.git] / opendaylight / netconf / netconf-impl / src / test / java / org / opendaylight / controller / netconf / impl / MessageHeaderTest.java
index aa3c5d4d9ba539167dd08aa3117dc45fbb7cc9b8..959e2ff144810c2017131e8041229e86b1cabd64 100644 (file)
@@ -8,33 +8,24 @@
 
 package org.opendaylight.controller.netconf.impl;
 
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.controller.netconf.util.messages.NetconfMessageHeader;
-
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 
-public class MessageHeaderTest {
-
-    private NetconfMessageHeader header = null;
-
-    @Before
-    public void setUp() {
-        this.header = new NetconfMessageHeader();
-    }
+import org.junit.Test;
+import org.opendaylight.controller.netconf.util.messages.NetconfMessageHeader;
 
+public class MessageHeaderTest {
     @Test
     public void testFromBytes() {
         final byte[] raw = new byte[] { (byte) 0x0a, (byte) 0x23, (byte) 0x35, (byte) 0x38, (byte) 0x0a };
-        this.header.fromBytes(raw);
-        assertEquals(58, this.header.getLength());
+        NetconfMessageHeader header = NetconfMessageHeader.fromBytes(raw);
+        assertEquals(58, header.getLength());
     }
 
     @Test
     public void testToBytes() {
-        this.header.setLength(123);
+        NetconfMessageHeader header = new NetconfMessageHeader(123);
         assertArrayEquals(new byte[] { (byte) 0x0a, (byte) 0x23, (byte) 0x31, (byte) 0x32, (byte) 0x33, (byte) 0x0a },
-                this.header.toBytes());
+                header.toBytes());
     }
 }