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;
14 import org.opendaylight.protocol.framework.DeserializerException;
15 import org.opendaylight.protocol.framework.DocumentedException;
17 public class APITest {
20 public void testDocumentedException() {
21 final DocumentedException de = new BGPDocumentedException("Some message", BGPError.BAD_BGP_ID);
22 assertEquals("Some message", de.getMessage());
23 assertEquals(BGPError.BAD_BGP_ID, ((BGPDocumentedException) de).getError());
24 assertNull(((BGPDocumentedException) de).getData());
28 public void testParsingException() {
29 final DeserializerException de = new BGPParsingException("Some message");
30 assertEquals("Some message", de.getMessage());
34 public void testBGPError() {
35 assertEquals(BGPError.BAD_MSG_TYPE, BGPError.forValue(1, 3));
39 public void testTerminationReason() {
40 assertEquals(BGPError.BAD_PEER_AS.toString(), new BGPTerminationReason(BGPError.BAD_PEER_AS).getErrorMessage());