4d6e8db4716c32d3c148146e205f73c9c9d0ad42
[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 package org.opendaylight.protocol.bgp.mvpn.spi.pojo.nlri;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertThrows;
12
13 import io.netty.buffer.ByteBuf;
14 import io.netty.buffer.Unpooled;
15 import org.junit.Test;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.NlriType;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.mvpn.MvpnChoice;
18
19 public final class SimpleMvpnNlriRegistryTest {
20     @Test
21     public void registryParseTest() {
22         assertThrows(IllegalArgumentException.class,
23             () -> SimpleMvpnNlriRegistry.getInstance().parseMvpn(NlriType.InterAsIPmsiAD, null));
24     }
25
26     @Test
27     public void registryNullTest() {
28         final ByteBuf body = Unpooled.buffer();
29         SimpleMvpnNlriRegistry.getInstance().serializeMvpn(new NotRegistered());
30         assertEquals(0, body.readableBytes());
31     }
32
33     private static final class NotRegistered implements MvpnChoice {
34         @Override
35         public Class<NotRegistered> implementedInterface() {
36             return NotRegistered.class;
37         }
38     }
39
40 }