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.impl;
10 import static org.junit.Assert.assertArrayEquals;
11 import static org.junit.Assert.assertEquals;
12 import static org.junit.Assert.fail;
14 import org.junit.Test;
15 import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
16 import org.opendaylight.protocol.bgp.parser.BGPParsingException;
17 import org.opendaylight.protocol.bgp.parser.spi.pojo.BGPExtensionConsumerContextImpl;
20 * To test incorrect values.
22 public class PathAttributeParserTest {
24 public void testOriginParser() {
26 BGPExtensionConsumerContextImpl.getSingletonInstance().getAttributeRegistry().parseAttributes(new byte[] { 0x40, 0x01, 0x01, 0x04 });
27 fail("This needs to fail.");
28 } catch (final BGPDocumentedException e) {
29 assertEquals("Unknown Origin type.", e.getMessage());
30 assertArrayEquals(new byte[] { 0x01, 0x01, 0x04 }, e.getData());
31 } catch (final BGPParsingException e) {
32 fail("This exception should not occur.");