Do not rely on deprecated classes directly
[bgpcep.git] / bgp / parser-api / src / test / java / org / opendaylight / protocol / bgp / parser / APITest.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.protocol.bgp.parser;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertNull;
12
13 import org.junit.Test;
14
15 public class APITest {
16
17         @Test
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());
23         }
24
25         @Test
26         public void testParsingException() {
27                 final BGPParsingException de = new BGPParsingException("Some message");
28                 assertEquals("Some message", de.getMessage());
29         }
30
31         @Test
32         public void testBGPError() {
33                 assertEquals(BGPError.BAD_MSG_TYPE, BGPError.forValue(1, 3));
34         }
35
36         @Test
37         public void testTerminationReason() {
38                 assertEquals(BGPError.BAD_PEER_AS.toString(), new BGPTerminationReason(BGPError.BAD_PEER_AS).getErrorMessage());
39         }
40 }