ec6d9d8535bb817201b15bdc59c03de9e89f2fa6
[bgpcep.git] / bgp / concepts / src / test / java / org / opendaylight / protocol / bgp / concepts / ClusterIdentifierTest.java
1 /*
2  * Copyright (c) 2013 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.concepts;
9
10 import static org.junit.Assert.assertArrayEquals;
11
12 import org.junit.Test;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ClusterIdentifier;
14
15 public class ClusterIdentifierTest {
16
17         @Test
18         public void testClusterIdentifier() {
19                 final ClusterIdentifier id = new ClusterIdentifier(new byte[] { 13, 14, 15, 16 });
20                 // FIXME: uncomment, once the generated code has length precondition
21                 // try {
22                 // new ClusterIdentifier(new byte[] { 5, 6 });
23                 // fail("Cluster ID is invalid!");
24                 // } catch (final IllegalArgumentException e) {
25                 // assertEquals("Invalid Cluster ID", e.getMessage());
26                 // }
27
28                 final ClusterIdentifier id1 = new ClusterIdentifier(new byte[] { 13, 14, 15, 16 });
29
30                 // FIXME: BUG-80 : uncomment, once it's done
31                 // assertEquals(id1.toString(), id.toString());
32
33                 assertArrayEquals(id1.getValue(), new byte[] { 13, 14, 15, 16 });
34         }
35 }