X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fimpl%2FMessageHeaderTest.java;fp=opendaylight%2Fnetconf%2Fnetconf-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fimpl%2FMessageHeaderTest.java;h=959e2ff144810c2017131e8041229e86b1cabd64;hb=195dbe7884c7338a8fe9b58765ca5665f4a6f78a;hp=aa3c5d4d9ba539167dd08aa3117dc45fbb7cc9b8;hpb=65309af0da8da39a3189dec7c62b16cf93ae2e78;p=controller.git diff --git a/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/MessageHeaderTest.java b/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/MessageHeaderTest.java index aa3c5d4d9b..959e2ff144 100644 --- a/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/MessageHeaderTest.java +++ b/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/MessageHeaderTest.java @@ -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()); } }