1 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
\r
2 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
\r
4 import io.netty.buffer.ByteBuf;
\r
6 import org.junit.Assert;
\r
7 import org.junit.Test;
\r
8 import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.EchoRequestMessageFactory;
\r
9 import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
\r
10 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessage;
\r
13 * @author michal.polkorab
\r
16 public class EchoRequestMessageFactoryTest {
\r
19 * Testing {@link EchoRequestMessageFactory} for correct translation into POJO
\r
22 public void testWithEmptyDataField() {
\r
23 ByteBuf bb = BufferHelper.buildBuffer();
\r
24 EchoRequestMessage builtByFactory = BufferHelper.decodeV13(
\r
25 EchoRequestMessageFactory.getInstance(), bb);
\r
27 BufferHelper.checkHeaderV13(builtByFactory);
\r
31 * Testing {@link EchoRequestMessageFactory} for correct translation into POJO
\r
34 public void testWithDataFieldSet() {
\r
35 byte[] data = new byte[]{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07};
\r
36 ByteBuf bb = BufferHelper.buildBuffer(data);
\r
37 EchoRequestMessage builtByFactory = BufferHelper.decodeV13(
\r
38 EchoRequestMessageFactory.getInstance(), bb);
\r
40 BufferHelper.checkHeaderV13(builtByFactory);
\r
41 Assert.assertArrayEquals(builtByFactory.getData(), data);
\r