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