Phaneendra Manda
Committed by Gerrit Code Review

Pcep TLVs UT updated for common review comments

Change-Id: Icf51f79e9cadd1ce4bdd5b2b67a1ad1095cc8ab8
Showing 24 changed files with 63 additions and 55 deletions
1 /* 1 /*
2 - * Copyright 2014 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
......
1 /* 1 /*
2 - * Copyright 2014 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
......
1 /* 1 /*
2 - * Copyright 2014 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
......
...@@ -155,9 +155,9 @@ public class MPLSProtocolMaskTlv implements PcepValueType { ...@@ -155,9 +155,9 @@ public class MPLSProtocolMaskTlv implements PcepValueType {
155 if (obj instanceof MPLSProtocolMaskTlv) { 155 if (obj instanceof MPLSProtocolMaskTlv) {
156 MPLSProtocolMaskTlv other = (MPLSProtocolMaskTlv) obj; 156 MPLSProtocolMaskTlv other = (MPLSProtocolMaskTlv) obj;
157 if (isRawValueSet) { 157 if (isRawValueSet) {
158 - return Objects.equals(this.bLFlag, other.bLFlag) && Objects.equals(this.bRFlag, other.bRFlag);
159 - } else {
160 return Objects.equals(this.rawValue, other.rawValue); 158 return Objects.equals(this.rawValue, other.rawValue);
159 + } else {
160 + return Objects.equals(this.bLFlag, other.bLFlag) && Objects.equals(this.bRFlag, other.bRFlag);
161 } 161 }
162 } 162 }
163 return false; 163 return false;
......
...@@ -174,10 +174,10 @@ public class NodeFlagBitsTlv implements PcepValueType { ...@@ -174,10 +174,10 @@ public class NodeFlagBitsTlv implements PcepValueType {
174 if (obj instanceof NodeFlagBitsTlv) { 174 if (obj instanceof NodeFlagBitsTlv) {
175 NodeFlagBitsTlv other = (NodeFlagBitsTlv) obj; 175 NodeFlagBitsTlv other = (NodeFlagBitsTlv) obj;
176 if (isRawValueSet) { 176 if (isRawValueSet) {
177 + return Objects.equals(this.rawValue, other.rawValue);
178 + } else {
177 return Objects.equals(this.bOFlag, other.bOFlag) && Objects.equals(this.bTFlag, other.bTFlag) 179 return Objects.equals(this.bOFlag, other.bOFlag) && Objects.equals(this.bTFlag, other.bTFlag)
178 && Objects.equals(this.bEFlag, other.bEFlag) && Objects.equals(this.bBFlag, other.bBFlag); 180 && Objects.equals(this.bEFlag, other.bEFlag) && Objects.equals(this.bBFlag, other.bBFlag);
179 - } else {
180 - return Objects.equals(this.rawValue, other.rawValue);
181 } 181 }
182 } 182 }
183 return false; 183 return false;
......
1 /* 1 /*
2 - * Copyright 2014 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
......
1 /* 1 /*
2 - * Copyright 2014 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
......
1 /* 1 /*
2 - * Copyright 2014 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
......
1 /* 1 /*
2 - * Copyright 2014 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
......
1 /* 1 /*
2 - * Copyright 2014 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
......
1 /* 1 /*
2 - * Copyright 2014 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
......
1 /* 1 /*
2 - * Copyright 2014 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
......
1 /* 1 /*
2 - * Copyright 2014 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
......
1 /* 1 /*
2 - * Copyright 2014 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
......
1 /* 1 /*
2 - * Copyright 2014 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
...@@ -15,13 +15,13 @@ ...@@ -15,13 +15,13 @@
15 */ 15 */
16 package org.onosproject.pcepio; 16 package org.onosproject.pcepio;
17 17
18 -import com.google.common.testing.EqualsTester;
19 -
20 import org.junit.Test; 18 import org.junit.Test;
21 import org.onosproject.pcepio.types.LinkNameTlv; 19 import org.onosproject.pcepio.types.LinkNameTlv;
22 20
21 +import com.google.common.testing.EqualsTester;
22 +
23 /** 23 /**
24 - * Test of the LinkNameTlv. 24 + * Equality test for LinkNameTlv.
25 */ 25 */
26 public class LinkNameTlvTest { 26 public class LinkNameTlvTest {
27 private final byte[] rawValue1 = new byte[] {0x01, 0x00}; 27 private final byte[] rawValue1 = new byte[] {0x01, 0x00};
...@@ -30,13 +30,12 @@ public class LinkNameTlvTest { ...@@ -30,13 +30,12 @@ public class LinkNameTlvTest {
30 private final LinkNameTlv tlv1 = new LinkNameTlv(rawValue1, (short) rawValue1.length); 30 private final LinkNameTlv tlv1 = new LinkNameTlv(rawValue1, (short) rawValue1.length);
31 private final LinkNameTlv sameAsTlv1 = LinkNameTlv.of(tlv1.getValue(), tlv1.getLength()); 31 private final LinkNameTlv sameAsTlv1 = LinkNameTlv.of(tlv1.getValue(), tlv1.getLength());
32 private final LinkNameTlv tlv2 = new LinkNameTlv(rawValue2, (short) 0); 32 private final LinkNameTlv tlv2 = new LinkNameTlv(rawValue2, (short) 0);
33 - private final LinkNameTlv sameAsTlv2 = new LinkNameTlv(rawValue2, (short) rawValue2.length);
34 33
35 @Test 34 @Test
36 public void basics() { 35 public void basics() {
37 new EqualsTester() 36 new EqualsTester()
38 .addEqualityGroup(tlv1, sameAsTlv1) 37 .addEqualityGroup(tlv1, sameAsTlv1)
39 - .addEqualityGroup(tlv2, sameAsTlv2) 38 + .addEqualityGroup(tlv2)
40 .testEquals(); 39 .testEquals();
41 } 40 }
42 } 41 }
......
1 -/* * Copyright 2014 Open Networking Laboratory * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package org.onosproject.pcepio; import com.google.common.testing.EqualsTester; import org.junit.Test;import org.onosproject.pcepio.types.LinkProtectionTypeTlv; /** * Test of the LinkProtectionTypeTlv. */public class LinkProtectionTypeTlvTest { private final byte rawValue1 = 0x0A; private final byte rawValue2 = 0x0A; private final LinkProtectionTypeTlv tlv1 = new LinkProtectionTypeTlv(rawValue1); private final LinkProtectionTypeTlv tlv2 = new LinkProtectionTypeTlv(rawValue2, (byte) 0); @Test public void basics() { new EqualsTester() .addEqualityGroup(tlv1, tlv2) .testEquals(); }}
...\ No newline at end of file ...\ No newline at end of file
1 +/* * Copyright 2015 Open Networking Laboratory * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package org.onosproject.pcepio; import org.junit.Test;import org.onosproject.pcepio.types.LinkProtectionTypeTlv; import com.google.common.testing.EqualsTester; /** * Test of the LinkProtectionTypeTlv. */public class LinkProtectionTypeTlvTest { private final byte rawValue1 = 0x0A; private final byte rawValue2 = 0x0B; private final LinkProtectionTypeTlv tlv1 = new LinkProtectionTypeTlv(rawValue1); private final LinkProtectionTypeTlv sameAsTlv1 = new LinkProtectionTypeTlv(rawValue1); private final LinkProtectionTypeTlv tlv2 = new LinkProtectionTypeTlv(rawValue2, (byte) 0); @Test public void basics() { new EqualsTester() .addEqualityGroup(tlv1, sameAsTlv1) .addEqualityGroup(tlv2) .testEquals(); }}
...\ No newline at end of file ...\ No newline at end of file
......
1 /* 1 /*
2 - * Copyright 2014 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
...@@ -15,25 +15,27 @@ ...@@ -15,25 +15,27 @@
15 */ 15 */
16 package org.onosproject.pcepio; 16 package org.onosproject.pcepio;
17 17
18 -import com.google.common.testing.EqualsTester;
19 -
20 import org.junit.Test; 18 import org.junit.Test;
21 import org.onosproject.pcepio.types.MPLSProtocolMaskTlv; 19 import org.onosproject.pcepio.types.MPLSProtocolMaskTlv;
22 20
21 +import com.google.common.testing.EqualsTester;
22 +
23 /** 23 /**
24 * Test of the MPLSProtocolMaskTlv. 24 * Test of the MPLSProtocolMaskTlv.
25 */ 25 */
26 public class MPLSProtocolMaskTlvTest { 26 public class MPLSProtocolMaskTlvTest {
27 private final byte rawValue1 = 0x0A; 27 private final byte rawValue1 = 0x0A;
28 - private final byte rawValue2 = 0x0A; 28 + private final byte rawValue2 = 0x0B;
29 29
30 private final MPLSProtocolMaskTlv tlv1 = new MPLSProtocolMaskTlv(rawValue1); 30 private final MPLSProtocolMaskTlv tlv1 = new MPLSProtocolMaskTlv(rawValue1);
31 + private final MPLSProtocolMaskTlv sameAsTlv1 = new MPLSProtocolMaskTlv(rawValue1);
31 private final MPLSProtocolMaskTlv tlv2 = MPLSProtocolMaskTlv.of(rawValue2); 32 private final MPLSProtocolMaskTlv tlv2 = MPLSProtocolMaskTlv.of(rawValue2);
32 33
33 @Test 34 @Test
34 public void basics() { 35 public void basics() {
35 new EqualsTester() 36 new EqualsTester()
36 - .addEqualityGroup(tlv1, tlv2) 37 + .addEqualityGroup(tlv1, sameAsTlv1)
38 + .addEqualityGroup(tlv2)
37 .testEquals(); 39 .testEquals();
38 } 40 }
39 } 41 }
......
1 /* 1 /*
2 - * Copyright 2014 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
...@@ -25,15 +25,17 @@ import com.google.common.testing.EqualsTester; ...@@ -25,15 +25,17 @@ import com.google.common.testing.EqualsTester;
25 */ 25 */
26 public class MaximumLinkBandwidthTlvTest { 26 public class MaximumLinkBandwidthTlvTest {
27 private final int rawValue1 = 0x0A; 27 private final int rawValue1 = 0x0A;
28 - private final int rawValue2 = 0x0A; 28 + private final int rawValue2 = 0x0B;
29 29
30 private final MaximumLinkBandwidthTlv tlv1 = new MaximumLinkBandwidthTlv(rawValue1); 30 private final MaximumLinkBandwidthTlv tlv1 = new MaximumLinkBandwidthTlv(rawValue1);
31 + private final MaximumLinkBandwidthTlv sameAsTlv1 = new MaximumLinkBandwidthTlv(rawValue1);
31 private final MaximumLinkBandwidthTlv tlv2 = MaximumLinkBandwidthTlv.of(rawValue2); 32 private final MaximumLinkBandwidthTlv tlv2 = MaximumLinkBandwidthTlv.of(rawValue2);
32 33
33 @Test 34 @Test
34 public void basics() { 35 public void basics() {
35 new EqualsTester() 36 new EqualsTester()
36 - .addEqualityGroup(tlv1, tlv2) 37 + .addEqualityGroup(tlv1, sameAsTlv1)
38 + .addEqualityGroup(tlv2)
37 .testEquals(); 39 .testEquals();
38 } 40 }
39 } 41 }
......
1 /* 1 /*
2 - * Copyright 2014 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
...@@ -25,15 +25,17 @@ import com.google.common.testing.EqualsTester; ...@@ -25,15 +25,17 @@ import com.google.common.testing.EqualsTester;
25 */ 25 */
26 public class MaximumReservableLinkBandwidthTlvTest { 26 public class MaximumReservableLinkBandwidthTlvTest {
27 private final int rawValue1 = 0x0A; 27 private final int rawValue1 = 0x0A;
28 - private final int rawValue2 = 0x0A; 28 + private final int rawValue2 = 0x0B;
29 29
30 private final MaximumReservableLinkBandwidthTlv tlv1 = new MaximumReservableLinkBandwidthTlv(rawValue1); 30 private final MaximumReservableLinkBandwidthTlv tlv1 = new MaximumReservableLinkBandwidthTlv(rawValue1);
31 + private final MaximumReservableLinkBandwidthTlv sameAsTlv1 = new MaximumReservableLinkBandwidthTlv(rawValue1);
31 private final MaximumReservableLinkBandwidthTlv tlv2 = MaximumReservableLinkBandwidthTlv.of(rawValue2); 32 private final MaximumReservableLinkBandwidthTlv tlv2 = MaximumReservableLinkBandwidthTlv.of(rawValue2);
32 33
33 @Test 34 @Test
34 public void basics() { 35 public void basics() {
35 new EqualsTester() 36 new EqualsTester()
36 - .addEqualityGroup(tlv1, tlv2) 37 + .addEqualityGroup(tlv1, sameAsTlv1)
38 + .addEqualityGroup(tlv2)
37 .testEquals(); 39 .testEquals();
38 } 40 }
39 } 41 }
......
1 /* 1 /*
2 - * Copyright 2014 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
...@@ -15,24 +15,27 @@ ...@@ -15,24 +15,27 @@
15 */ 15 */
16 package org.onosproject.pcepio; 16 package org.onosproject.pcepio;
17 17
18 -import com.google.common.testing.EqualsTester;
19 -
20 import org.junit.Test; 18 import org.junit.Test;
21 import org.onosproject.pcepio.types.NodeFlagBitsTlv; 19 import org.onosproject.pcepio.types.NodeFlagBitsTlv;
22 20
21 +import com.google.common.testing.EqualsTester;
22 +
23 /** 23 /**
24 * Test of the NodeFlagBitsTlv. 24 * Test of the NodeFlagBitsTlv.
25 */ 25 */
26 public class NodeFlagBitsTlvTest { 26 public class NodeFlagBitsTlvTest {
27 private final byte rawValue1 = 0x0A; 27 private final byte rawValue1 = 0x0A;
28 + private final byte rawValue2 = 0x0B;
28 29
29 private final NodeFlagBitsTlv tlv1 = new NodeFlagBitsTlv(rawValue1); 30 private final NodeFlagBitsTlv tlv1 = new NodeFlagBitsTlv(rawValue1);
30 - private final NodeFlagBitsTlv tlv2 = NodeFlagBitsTlv.of(tlv1.getbyte()); 31 + private final NodeFlagBitsTlv sameAsTlv1 = new NodeFlagBitsTlv(rawValue1);
32 + private final NodeFlagBitsTlv tlv2 = NodeFlagBitsTlv.of(rawValue2);
31 33
32 @Test 34 @Test
33 public void basics() { 35 public void basics() {
34 new EqualsTester() 36 new EqualsTester()
35 - .addEqualityGroup(tlv1, tlv2) 37 + .addEqualityGroup(tlv1, sameAsTlv1)
38 + .addEqualityGroup(tlv2)
36 .testEquals(); 39 .testEquals();
37 } 40 }
38 } 41 }
......
1 /* 1 /*
2 - * Copyright 2014 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
...@@ -15,11 +15,11 @@ ...@@ -15,11 +15,11 @@
15 */ 15 */
16 package org.onosproject.pcepio; 16 package org.onosproject.pcepio;
17 17
18 -import com.google.common.testing.EqualsTester;
19 -
20 import org.junit.Test; 18 import org.junit.Test;
21 import org.onosproject.pcepio.types.NodeNameTlv; 19 import org.onosproject.pcepio.types.NodeNameTlv;
22 20
21 +import com.google.common.testing.EqualsTester;
22 +
23 /** 23 /**
24 * Test of the NodeNameTlv. 24 * Test of the NodeNameTlv.
25 */ 25 */
...@@ -30,13 +30,12 @@ public class NodeNameTlvTest { ...@@ -30,13 +30,12 @@ public class NodeNameTlvTest {
30 private final NodeNameTlv tlv1 = new NodeNameTlv(rawValue1, (short) rawValue1.length); 30 private final NodeNameTlv tlv1 = new NodeNameTlv(rawValue1, (short) rawValue1.length);
31 private final NodeNameTlv sameAsTlv1 = NodeNameTlv.of(tlv1.getValue(), tlv1.getLength()); 31 private final NodeNameTlv sameAsTlv1 = NodeNameTlv.of(tlv1.getValue(), tlv1.getLength());
32 private final NodeNameTlv tlv2 = new NodeNameTlv(rawValue2, (short) 0); 32 private final NodeNameTlv tlv2 = new NodeNameTlv(rawValue2, (short) 0);
33 - private final NodeNameTlv sameAsTlv2 = new NodeNameTlv(rawValue2, (short) rawValue2.length);
34 33
35 @Test 34 @Test
36 public void basics() { 35 public void basics() {
37 new EqualsTester() 36 new EqualsTester()
38 .addEqualityGroup(tlv1, sameAsTlv1) 37 .addEqualityGroup(tlv1, sameAsTlv1)
39 - .addEqualityGroup(tlv2, sameAsTlv2) 38 + .addEqualityGroup(tlv2)
40 .testEquals(); 39 .testEquals();
41 } 40 }
42 } 41 }
......
1 /* 1 /*
2 - * Copyright 2014 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
......
1 /* 1 /*
2 - * Copyright 2014 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
...@@ -15,11 +15,11 @@ ...@@ -15,11 +15,11 @@
15 */ 15 */
16 package org.onosproject.pcepio; 16 package org.onosproject.pcepio;
17 17
18 -import com.google.common.testing.EqualsTester;
19 -
20 import org.junit.Test; 18 import org.junit.Test;
21 import org.onosproject.pcepio.types.OpaqueLinkAttributeTlv; 19 import org.onosproject.pcepio.types.OpaqueLinkAttributeTlv;
22 20
21 +import com.google.common.testing.EqualsTester;
22 +
23 /** 23 /**
24 * Test of the OpaqueLinkAttributeTlv. 24 * Test of the OpaqueLinkAttributeTlv.
25 */ 25 */
...@@ -30,13 +30,12 @@ public class OpaqueLinkAttributeTlvTest { ...@@ -30,13 +30,12 @@ public class OpaqueLinkAttributeTlvTest {
30 private final OpaqueLinkAttributeTlv tlv1 = new OpaqueLinkAttributeTlv(rawValue1, (short) rawValue1.length); 30 private final OpaqueLinkAttributeTlv tlv1 = new OpaqueLinkAttributeTlv(rawValue1, (short) rawValue1.length);
31 private final OpaqueLinkAttributeTlv sameAsTlv1 = OpaqueLinkAttributeTlv.of(tlv1.getValue(), tlv1.getLength()); 31 private final OpaqueLinkAttributeTlv sameAsTlv1 = OpaqueLinkAttributeTlv.of(tlv1.getValue(), tlv1.getLength());
32 private final OpaqueLinkAttributeTlv tlv2 = new OpaqueLinkAttributeTlv(rawValue2, (short) 0); 32 private final OpaqueLinkAttributeTlv tlv2 = new OpaqueLinkAttributeTlv(rawValue2, (short) 0);
33 - private final OpaqueLinkAttributeTlv sameAsTlv2 = new OpaqueLinkAttributeTlv(rawValue2, (short) rawValue2.length);
34 33
35 @Test 34 @Test
36 public void basics() { 35 public void basics() {
37 new EqualsTester() 36 new EqualsTester()
38 .addEqualityGroup(tlv1, sameAsTlv1) 37 .addEqualityGroup(tlv1, sameAsTlv1)
39 - .addEqualityGroup(tlv2, sameAsTlv2) 38 + .addEqualityGroup(tlv2)
40 .testEquals(); 39 .testEquals();
41 } 40 }
42 } 41 }
......
1 /* 1 /*
2 - * Copyright 2014 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
...@@ -15,25 +15,27 @@ ...@@ -15,25 +15,27 @@
15 */ 15 */
16 package org.onosproject.pcepio; 16 package org.onosproject.pcepio;
17 17
18 -import com.google.common.testing.EqualsTester;
19 -
20 import org.junit.Test; 18 import org.junit.Test;
21 import org.onosproject.pcepio.types.PceccCapabilityTlv; 19 import org.onosproject.pcepio.types.PceccCapabilityTlv;
22 20
21 +import com.google.common.testing.EqualsTester;
22 +
23 /** 23 /**
24 * Test of the PceccCapabilityTlv. 24 * Test of the PceccCapabilityTlv.
25 */ 25 */
26 public class PceccCapabilityTlvTest { 26 public class PceccCapabilityTlvTest {
27 private final int rawValue1 = 0x0A; 27 private final int rawValue1 = 0x0A;
28 - private final int rawValue2 = 0x0A; 28 + private final int rawValue2 = 0x0B;
29 29
30 private final PceccCapabilityTlv tlv1 = new PceccCapabilityTlv(rawValue1); 30 private final PceccCapabilityTlv tlv1 = new PceccCapabilityTlv(rawValue1);
31 + private final PceccCapabilityTlv sameAsTlv1 = new PceccCapabilityTlv(rawValue1);
31 private final PceccCapabilityTlv tlv2 = PceccCapabilityTlv.of(rawValue2); 32 private final PceccCapabilityTlv tlv2 = PceccCapabilityTlv.of(rawValue2);
32 33
33 @Test 34 @Test
34 public void basics() { 35 public void basics() {
35 new EqualsTester() 36 new EqualsTester()
36 - .addEqualityGroup(tlv1, tlv2) 37 + .addEqualityGroup(tlv1, sameAsTlv1)
38 + .addEqualityGroup(tlv2)
37 .testEquals(); 39 .testEquals();
38 } 40 }
39 } 41 }
......