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
9 package org.opendaylight.protocol.bgp.mvpn.spi.pojo.nlri;
11 import static org.junit.Assert.assertEquals;
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;
22 public final class SimpleMvpnNlriRegistryTest {
25 NlriActivator.registerNlriParsers(new ArrayList<>());
28 @Test(expected = IllegalArgumentException.class)
29 public void registryParseTest() {
30 SimpleMvpnNlriRegistry.getInstance().parseMvpn(NlriType.InterAsIPmsiAD, null);
34 public void registryNullTest() {
35 final ByteBuf body = Unpooled.buffer();
36 SimpleMvpnNlriRegistry.getInstance().serializeMvpn(new NotRegistered());
37 assertEquals(0, body.readableBytes());
40 private class NotRegistered implements MvpnChoice {
42 public Class<NotRegistered> implementedInterface() {
43 return NotRegistered.class;