dd88a03b442ff407e4e2a5e3504af18ff78c9f07
[bgpcep.git] / bgp / parser-spi / src / test / java / org / opendaylight / protocol / bgp / parser / spi / extended / community / AbstractOpaqueExtendedCommunityTest.java
1 /*
2  * Copyright (c) 2015 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
9 package org.opendaylight.protocol.bgp.parser.spi.extended.community;
10
11 import io.netty.buffer.ByteBuf;
12 import org.junit.Assert;
13 import org.junit.Test;
14 import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
15 import org.opendaylight.protocol.bgp.parser.BGPParsingException;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.extended.community.ExtendedCommunity;
17
18 public class AbstractOpaqueExtendedCommunityTest {
19
20     @Test
21     public void testGetType() {
22         final AbstractOpaqueExtendedCommunity abstractOpaqueExtendedCommunity = new AbstractOpaqueExtendedCommunity() {
23
24             @Override
25             public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf byteAggregator) {
26             }
27             @Override
28             public int getSubType() {
29                 return 0;
30             }
31
32             @Override
33             public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
34                 return null;
35             }
36         };
37         Assert.assertEquals(3, abstractOpaqueExtendedCommunity.getType(true));
38         Assert.assertEquals(67, abstractOpaqueExtendedCommunity.getType(false));
39     }
40
41 }