Merge "Optimize xsql's use of collections"
[controller.git] / opendaylight / netconf / netconf-netty-util / src / test / java / org / opendaylight / controller / netconf / nettyutil / handler / NetconfXMLToMessageDecoderTest.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.controller.netconf.nettyutil.handler;
10
11 import static org.junit.Assert.assertEquals;
12
13 import com.google.common.collect.Lists;
14 import io.netty.buffer.Unpooled;
15 import java.util.ArrayList;
16 import org.junit.Test;
17
18 public class NetconfXMLToMessageDecoderTest {
19
20     @Test
21     public void testDecodeNoMoreContent() throws Exception {
22         final ArrayList<Object> out = Lists.newArrayList();
23         new NetconfXMLToMessageDecoder().decode(null, Unpooled.buffer(), out);
24         assertEquals(0, out.size());
25     }
26
27     @Test
28     public void testDecode() throws Exception {
29         final ArrayList<Object> out = Lists.newArrayList();
30         new NetconfXMLToMessageDecoder().decode(null, Unpooled.wrappedBuffer("<msg/>".getBytes()), out);
31         assertEquals(1, out.size());
32     }
33 }