Bump MDSAL to 4.0.0
[bgpcep.git] / bgp / extensions / mvpn / src / test / java / org / opendaylight / protocol / bgp / mvpn / spi / pojo / nlri / SimpleMvpnNlriRegistryTest.java
1 /*
2  * Copyright (c) 2018 AT&T Intellectual Property. 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.protocol.bgp.mvpn.spi.pojo.nlri;
10
11 import static org.junit.Assert.assertEquals;
12
13 import io.netty.buffer.ByteBuf;
14 import io.netty.buffer.Unpooled;
15 import java.util.ArrayList;
16 import org.junit.Before;
17 import org.junit.Test;
18 import org.opendaylight.protocol.bgp.mvpn.impl.NlriActivator;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev180417.NlriType;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev180417.mvpn.MvpnChoice;
21
22 public final class SimpleMvpnNlriRegistryTest {
23     @Before
24     public void setUp() {
25         NlriActivator.registerNlriParsers(new ArrayList<>());
26     }
27
28     @Test(expected = IllegalArgumentException.class)
29     public void registryParseTest() {
30         SimpleMvpnNlriRegistry.getInstance().parseMvpn(NlriType.InterAsIPmsiAD, null);
31     }
32
33     @Test
34     public void registryNullTest() {
35         final ByteBuf body = Unpooled.buffer();
36         SimpleMvpnNlriRegistry.getInstance().serializeMvpn(new NotRegistered());
37         assertEquals(0, body.readableBytes());
38     }
39
40     private class NotRegistered implements MvpnChoice {
41         @Override
42         public Class<NotRegistered> implementedInterface() {
43             return NotRegistered.class;
44         }
45     }
46
47 }