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.types.rev130919.Ipv4AddressFamily;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv6AddressFamily;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.MplsLabeledVpnSubsequentAddressFamily;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.UnicastSubsequentAddressFamily;
21 public class TableTypeTest {
24 public void testTableTypes() {
25 final BGPTableType tt1 = new BGPTableType(Ipv4AddressFamily.class, MplsLabeledVpnSubsequentAddressFamily.class);
26 final BGPTableType tt2 = new BGPTableType(Ipv6AddressFamily.class, MplsLabeledVpnSubsequentAddressFamily.class);
27 final BGPTableType tt3 = new BGPTableType(Ipv6AddressFamily.class, UnicastSubsequentAddressFamily.class);
30 new BGPTableType(null, MplsLabeledVpnSubsequentAddressFamily.class);
32 } catch (final NullPointerException e) {
33 assertEquals("Address family may not be null", e.getMessage());
37 new BGPTableType(Ipv6AddressFamily.class, null);
39 } catch (final NullPointerException e) {
40 assertEquals("Subsequent address family may not be null", e.getMessage());
43 assertFalse(tt1.equals(tt2));
44 assertNotSame(tt1.hashCode(), tt2.hashCode());
45 assertEquals(tt1.toString(), tt1.toString());
46 assertNotSame(tt1.getAddressFamily(), tt2.getAddressFamily());
47 assertEquals(tt1.getSubsequentAddressFamily(), tt2.getSubsequentAddressFamily());