f314a3ae722ec3d60c8bcff0f726ac22aff25f36
[openflowjava.git] / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / util / ListSerializerTest.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 io.netty.buffer.ByteBuf;\r
12 import io.netty.buffer.PooledByteBufAllocator;\r
13 \r
14 import java.util.List;\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.SerializerRegistry;\r
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
23 \r
24 /**\r
25  * @author michal.polkorab\r
26  *\r
27  */\r
28 @RunWith(MockitoJUnitRunner.class)\r
29 public class ListSerializerTest {\r
30 \r
31     @Mock TypeKeyMaker<Action> keyMaker;\r
32     @Mock SerializerRegistry registry;\r
33 \r
34     /**\r
35      * Tests {@link ListSerializer#serializeHeaderList(List, TypeKeyMaker, SerializerRegistry, ByteBuf)}\r
36      * with null List\r
37      */\r
38     @Test\r
39     public void test() {\r
40         ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
41         ListSerializer.serializeHeaderList(null, keyMaker, registry, buffer);\r
42 \r
43         Assert.assertEquals("Data written to buffer", 0, buffer.readableBytes());\r
44     }\r
45 }