2 * Copyright (c) 2013 Cisco Systems, Inc. and others. 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.parser;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertFalse;
12 import static org.junit.Assert.assertNotSame;
13 import static org.junit.Assert.fail;
15 import org.junit.Test;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.BgpTableType;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv4AddressFamily;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv6AddressFamily;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.MplsLabeledVpnSubsequentAddressFamily;
21 public class TableTypeTest {
24 public void testTableTypes() {
25 final BgpTableType tt1 = new BgpTableTypeImpl(Ipv4AddressFamily.class,
26 MplsLabeledVpnSubsequentAddressFamily.class);
27 final BgpTableType tt2 = new BgpTableTypeImpl(Ipv6AddressFamily.class,
28 MplsLabeledVpnSubsequentAddressFamily.class);
31 new BgpTableTypeImpl(null, MplsLabeledVpnSubsequentAddressFamily.class);
33 } catch (final NullPointerException e) {
34 assertEquals("Address family may not be null", e.getMessage());
38 new BgpTableTypeImpl(Ipv6AddressFamily.class, null);
40 } catch (final NullPointerException e) {
41 assertEquals("Subsequent address family may not be null", e.getMessage());
44 assertFalse(tt1.equals(tt2));
45 assertNotSame(tt1.hashCode(), tt2.hashCode());
46 assertEquals(tt1.toString(), tt1.toString());
47 assertNotSame(tt1.getAfi(), tt2.getAfi());
48 assertEquals(tt1.getSafi(), tt2.getSafi());