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.concepts;
10 import static org.junit.Assert.assertArrayEquals;
11 import static org.junit.Assert.assertEquals;
12 import static org.junit.Assert.assertNotSame;
13 import static org.junit.Assert.assertTrue;
14 import static org.junit.Assert.fail;
16 import org.junit.Before;
17 import org.junit.Ignore;
18 import org.junit.Test;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.extended.community.extended.community.c.opaque.extended.community.OpaqueExtendedCommunity;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.extended.community.extended.community.c.opaque.extended.community.OpaqueExtendedCommunityBuilder;
22 public class OpaqueExtendedCommunityTest {
24 private boolean transitive;
27 private OpaqueExtendedCommunity community;
31 this.transitive = true;
32 this.value = new byte[] { 1, 5, 9, 3, 5, 7 };
33 this.community = new OpaqueExtendedCommunityBuilder().setTransitive(this.transitive).setValue(this.value).build();
38 // FIXME: when length is implemented
39 public void testOverflows() {
41 new OpaqueExtendedCommunityBuilder().setTransitive(this.transitive).setValue(new byte[] { 0, 1, 2, 3, 4, 5, 6, }).build();
42 fail("Constructor successful unexpectedly");
43 } catch (final IllegalArgumentException e) {
44 assertEquals("Invalid value", e.getMessage());
49 public void testGetValue() {
50 assertArrayEquals(new byte[] { 1, 5, 9, 3, 5, 7 }, this.community.getValue());
54 public void testIsTransitive() {
55 assertTrue(this.community.isTransitive());
59 public void testToString() {
60 final OpaqueExtendedCommunity c = new OpaqueExtendedCommunityBuilder().setTransitive(false).setValue(this.value).build();
61 assertNotSame(c.toString(), this.community.toString());