Merge "BUG-48: define a new submission error"
[bgpcep.git] / pcep / impl / src / test / java / org / opendaylight / protocol / pcep / impl / LabelSubobjectParserTest.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.pcep.impl;
9
10 import static org.junit.Assert.assertArrayEquals;
11 import static org.junit.Assert.assertEquals;
12
13 import org.junit.Test;
14 import org.opendaylight.protocol.pcep.PCEPDeserializerException;
15 import org.opendaylight.protocol.pcep.impl.subobject.GeneralizedLabelParser;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.label.subobject.label.type.GeneralizedLabelBuilder;
17
18 public class LabelSubobjectParserTest {
19
20         private final byte[] generalizedLabelBytes = { (byte) 0x12, (byte) 0x00, (byte) 0x25, (byte) 0xFF };
21
22         @Test
23         public void testGeneralizedLabel() throws PCEPDeserializerException {
24                 final GeneralizedLabelParser parser = new GeneralizedLabelParser();
25                 final GeneralizedLabelBuilder builder = new GeneralizedLabelBuilder();
26                 builder.setGeneralizedLabel(this.generalizedLabelBytes);
27                 assertEquals(builder.build(), parser.parseLabel(this.generalizedLabelBytes));
28                 assertArrayEquals(this.generalizedLabelBytes, parser.serializeLabel(builder.build()));
29         }
30 }