Fix most bgp-parser-spi checkstyle violations
[bgpcep.git] / bgp / parser-spi / src / test / java / org / opendaylight / protocol / bgp / parser / spi / extended / community / ExtendedCommunityUtilTest.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 static org.junit.Assert.assertEquals;
12
13 import java.lang.reflect.Constructor;
14 import java.lang.reflect.InvocationTargetException;
15 import org.junit.Assert;
16 import org.junit.Test;
17
18 public class ExtendedCommunityUtilTest {
19
20     @Test(expected = UnsupportedOperationException.class)
21     public void testPrivateConstructor() throws Throwable {
22         final Constructor<ExtendedCommunityUtil> c = ExtendedCommunityUtil.class.getDeclaredConstructor();
23         c.setAccessible(true);
24         try {
25             c.newInstance();
26         } catch (final InvocationTargetException e) {
27             throw e.getCause();
28         }
29     }
30
31     @Test
32     public void testGetType() {
33         assertEquals(1, ExtendedCommunityUtil.setTransitivity(1, true));
34         assertEquals(65, ExtendedCommunityUtil.setTransitivity(1, false));
35     }
36
37     @Test
38     public void testIsTransitiveType() {
39         Assert.assertTrue(ExtendedCommunityUtil.isTransitive(2));
40         Assert.assertFalse(ExtendedCommunityUtil.isTransitive(66));
41     }
42
43 }