Integration test, SimpleClient bundle
[openflowjava.git] / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / deserialization / factories / ErrorMessageFactoryTest.java
1 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
2 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
3
4 import io.netty.buffer.ByteBuf;
5
6 import org.junit.Assert;
7 import org.junit.Test;
8 import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
9 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
10
11 /**
12  * @author michal.polkorab
13  * @author timotej.kubas
14  */
15 public class ErrorMessageFactoryTest {
16
17     /**
18      * Test of {@link ErrorMessageFactory} for correct translation into POJO
19      */
20     @Test
21     public void test() {
22         ByteBuf bb = BufferHelper.buildBuffer("00 04 00 03 01 02 03 04");
23         ErrorMessage builtByFactory = BufferHelper.decodeV13(ErrorMessageFactory.getInstance(), bb);
24         BufferHelper.checkHeaderV13(builtByFactory);
25         
26         Assert.assertEquals("Wrong reason", 0x04, builtByFactory.getType().getIntValue());
27         Assert.assertEquals("Wrong code", 3, builtByFactory.getCode().intValue());
28         Assert.assertArrayEquals("Wrong body", new byte[]{0x01, 0x02, 0x03, 0x04}, builtByFactory.getData());
29     }
30 }