blob: c89a77f8977cda722a8b86f4a0c61e1abcd3c5bc [file] [log] [blame]
Mahesh Poojary S5afd06c2015-08-21 14:51:04 +05301/*
Phaneendra Manda55180672015-08-25 23:42:55 +05302 * Copyright 2015 Open Networking Laboratory
Mahesh Poojary S5afd06c2015-08-21 14:51:04 +05303 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.pcepio;
17
Mahesh Poojary S5afd06c2015-08-21 14:51:04 +053018import org.junit.Test;
19import org.onosproject.pcepio.types.LinkNameTlv;
20
Phaneendra Manda55180672015-08-25 23:42:55 +053021import com.google.common.testing.EqualsTester;
22
Mahesh Poojary S5afd06c2015-08-21 14:51:04 +053023/**
Phaneendra Manda55180672015-08-25 23:42:55 +053024 * Equality test for LinkNameTlv.
Mahesh Poojary S5afd06c2015-08-21 14:51:04 +053025 */
26public class LinkNameTlvTest {
27 private final byte[] rawValue1 = new byte[] {0x01, 0x00};
28 private final byte[] rawValue2 = new byte[] {0x02, 0x00};
29
30 private final LinkNameTlv tlv1 = new LinkNameTlv(rawValue1, (short) rawValue1.length);
31 private final LinkNameTlv sameAsTlv1 = LinkNameTlv.of(tlv1.getValue(), tlv1.getLength());
32 private final LinkNameTlv tlv2 = new LinkNameTlv(rawValue2, (short) 0);
Mahesh Poojary S5afd06c2015-08-21 14:51:04 +053033
34 @Test
35 public void basics() {
36 new EqualsTester()
37 .addEqualityGroup(tlv1, sameAsTlv1)
Phaneendra Manda55180672015-08-25 23:42:55 +053038 .addEqualityGroup(tlv2)
Mahesh Poojary S5afd06c2015-08-21 14:51:04 +053039 .testEquals();
40 }
41}