Further migration of test code from legacy setters
[bgpcep.git] / pcep / segment-routing / src / test / java / org / opendaylight / protocol / pcep / segment / routing / PCEPSegmentRoutingCapabilityTest.java
1 /*
2  * Copyright (c) 2014 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.segment.routing;
9
10 import org.junit.Assert;
11 import org.junit.Test;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.pce.capability.tlv.SrPceCapabilityBuilder;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.Tlvs;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.TlvsBuilder;
15 import org.opendaylight.yangtools.yang.common.Uint8;
16
17 public class PCEPSegmentRoutingCapabilityTest {
18
19     private static final Tlvs EXPECTED_TLVS =
20         new TlvsBuilder().addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment
21             .routing.rev181109.Tlvs1.class, new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep
22                 .segment.routing.rev181109.Tlvs1Builder().setSrPceCapability(new SrPceCapabilityBuilder()
23                     .setMsd(Uint8.ZERO).build()).build()).build();
24
25     @Test
26     public void testSegmentRoutingCapability() {
27         final PCEPSegmentRoutingCapability sspf = new PCEPSegmentRoutingCapability(true);
28         Assert.assertTrue(sspf.isSegmentRoutingCapable());
29         final TlvsBuilder builder = new TlvsBuilder();
30         sspf.setCapabilityProposal(null, builder);
31         Assert.assertEquals(EXPECTED_TLVS, builder.build());
32     }
33 }