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