2 * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
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
8 package org.opendaylight.protocol.bgp.mvpn.spi.pojo.nlri;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertThrows;
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;
19 public final class SimpleMvpnNlriRegistryTest {
21 public void registryParseTest() {
22 assertThrows(IllegalArgumentException.class,
23 () -> SimpleMvpnNlriRegistry.getInstance().parseMvpn(NlriType.InterAsIPmsiAD, null));
27 public void registryNullTest() {
28 final ByteBuf body = Unpooled.buffer();
29 SimpleMvpnNlriRegistry.getInstance().serializeMvpn(new NotRegistered());
30 assertEquals(0, body.readableBytes());
33 private static final class NotRegistered implements MvpnChoice {
35 public Class<NotRegistered> implementedInterface() {
36 return NotRegistered.class;