1 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
2 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
4 import io.netty.buffer.ByteBuf;
6 import org.junit.Assert;
8 import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
9 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
12 * @author michal.polkorab
13 * @author timotej.kubas
15 public class ErrorMessageFactoryTest {
18 * Test of {@link ErrorMessageFactory} for correct translation into POJO
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);
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());