446533a9570b5924da61fe97aee994fd4729a502
[openflowjava.git] / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / util / ListDeserializerTest.java
1 /*\r
2  * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
3  *\r
4  * This program and the accompanying materials are made available under the\r
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
6  * and is available at http://www.eclipse.org/legal/epl-v10.html\r
7  */\r
8 \r
9 package org.opendaylight.openflowjava.protocol.impl.util;\r
10 \r
11 import java.util.List;\r
12 \r
13 import io.netty.buffer.ByteBuf;\r
14 import io.netty.buffer.PooledByteBufAllocator;\r
15 \r
16 import org.junit.Assert;\r
17 import org.junit.Test;\r
18 import org.junit.runner.RunWith;\r
19 import org.mockito.Mock;\r
20 import org.mockito.runners.MockitoJUnitRunner;\r
21 import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
22 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
23 import org.opendaylight.yangtools.yang.binding.DataObject;\r
24 \r
25 /**\r
26  * @author michal.polkorab\r
27  *\r
28  */\r
29 @RunWith(MockitoJUnitRunner.class)\r
30 public class ListDeserializerTest {\r
31 \r
32     @Mock CodeKeyMaker keyMaker;\r
33     @Mock DeserializerRegistry registry;\r
34 \r
35     /**\r
36      * Tests {@link ListDeserializer#deserializeList(short, int, ByteBuf, CodeKeyMaker, DeserializerRegistry)}\r
37      */\r
38     @Test\r
39     public void test() {\r
40         ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
41         List<DataObject> list = ListDeserializer.deserializeList(EncodeConstants.OF13_VERSION_ID,\r
42                 42, buffer, keyMaker, registry);\r
43 \r
44         Assert.assertNull("List is not null", list);\r
45     }\r
46 \r
47     /**\r
48      * Tests {@link ListDeserializer#deserializeHeaders(short, int, ByteBuf, CodeKeyMaker, DeserializerRegistry)}\r
49      */\r
50     @Test\r
51     public void test2() {\r
52         ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
53         List<DataObject> list = ListDeserializer.deserializeHeaders(EncodeConstants.OF13_VERSION_ID,\r
54                 42, buffer, keyMaker, registry);\r
55 \r
56         Assert.assertNull("List is not null", list);\r
57     }\r
58 }