1 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
\r
3 import io.netty.buffer.ByteBuf;
\r
5 import org.junit.Assert;
\r
6 import org.junit.Test;
\r
7 import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
\r
8 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
\r
11 * @author michal.polkorab
\r
12 * @author timotej.kubas
\r
14 public class ErrorMessageFactoryTest {
\r
17 * Test of {@link ErrorMessageFactory} for correct translation into POJO
\r
20 public void test() {
\r
21 ByteBuf bb = BufferHelper.buildBuffer("00 04 00 03 01 02 03 04");
\r
22 ErrorMessage builtByFactory = BufferHelper.decodeV13(ErrorMessageFactory.getInstance(), bb);
\r
23 BufferHelper.checkHeaderV13(builtByFactory);
\r
25 Assert.assertEquals("Wrong reason", 0x04, builtByFactory.getType().getIntValue());
\r
26 Assert.assertEquals("Wrong code", 3, builtByFactory.getCode().intValue());
\r
27 Assert.assertArrayEquals("Wrong body", new byte[]{0x01, 0x02, 0x03, 0x04}, builtByFactory.getData());
\r