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.assertNull;
13 import org.junit.Test;
15 public class APITest {
18 public void testDocumentedException() {
19 final BGPDocumentedException de = new BGPDocumentedException("Some message", BGPError.BAD_BGP_ID);
20 assertEquals("Some message", de.getMessage());
21 assertEquals(BGPError.BAD_BGP_ID, de.getError());
22 assertNull(de.getData());
26 public void testParsingException() {
27 final BGPParsingException de = new BGPParsingException("Some message");
28 assertEquals("Some message", de.getMessage());
32 public void testBGPError() {
33 assertEquals(BGPError.BAD_MSG_TYPE, BGPError.forValue(1, 3));
37 public void testTerminationReason() {
38 assertEquals(BGPError.BAD_PEER_AS.toString(), new BGPTerminationReason(BGPError.BAD_PEER_AS).getErrorMessage());