Mass-convert all compontents to use -no-zone addresses
[bgpcep.git] / bgp / parser-impl / src / test / java / org / opendaylight / protocol / bgp / parser / impl / message / update / ClusterIdAttributeParserTest.java
index a364edd5a267b26de9dd52d5733953ff2328ac6b..47a587c3192f1e47afa0abe7a52331898f97357e 100644 (file)
@@ -5,28 +5,29 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.parser.impl.message.update;
 
-import com.google.common.collect.Lists;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
+import java.util.ArrayList;
 import java.util.List;
-import junit.framework.TestCase;
-import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.protocol.util.ByteArray;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.Attributes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.AttributesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.ClusterIdBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ClusterIdentifier;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.Attributes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.AttributesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.attributes.ClusterIdBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.ClusterIdentifier;
 
-public class ClusterIdAttributeParserTest extends TestCase {
-    private static final byte[] clusterIdBytes = {(byte) 0x80, (byte) 0x0A, (byte) 0x08,
-        (byte) 0xC0, (byte) 0xA8, (byte) 0x1, (byte) 0x1,
-        (byte) 0xC0, (byte) 0xA8, (byte) 0x1, (byte) 0x2};
+public class ClusterIdAttributeParserTest {
+    private static final byte[] CLUSTER_ID_BYTES = {
+        (byte) 0x80, (byte) 0x0A, (byte) 0x08,
+        (byte) 0xC0, (byte) 0xA8, (byte) 0x1, (byte) 0x1, (byte) 0xC0, (byte) 0xA8, (byte) 0x1, (byte) 0x2
+    };
     ClusterIdAttributeParser parser;
 
     @Before
@@ -36,30 +37,31 @@ public class ClusterIdAttributeParserTest extends TestCase {
 
     @Test
     public void testParserAttribute() throws Exception {
-        final List<ClusterIdentifier> list = Lists.newArrayList();
-        final Ipv4Address ip1 = new Ipv4Address("192.168.1.1");
-        final Ipv4Address ip2 = new Ipv4Address("192.168.1.2");
+        final List<ClusterIdentifier> list = new ArrayList<>();
+        final Ipv4AddressNoZone ip1 = new Ipv4AddressNoZone("192.168.1.1");
+        final Ipv4AddressNoZone ip2 = new Ipv4AddressNoZone("192.168.1.2");
         list.add(new ClusterIdentifier(ip1));
         list.add(new ClusterIdentifier(ip2));
-        final Attributes clusterId = new AttributesBuilder().setClusterId(new ClusterIdBuilder().setCluster
-            (list).build()).build();
+        final Attributes clusterId = new AttributesBuilder().setClusterId(new ClusterIdBuilder().setCluster(list)
+            .build()).build();
 
 
         final ByteBuf output = Unpooled.buffer();
         this.parser.serializeAttribute(clusterId, output);
 
-        Assert.assertArrayEquals(clusterIdBytes, ByteArray.getAllBytes(output));
+        assertArrayEquals(CLUSTER_ID_BYTES, ByteArray.getAllBytes(output));
 
         AttributesBuilder clusterIdOutput = new AttributesBuilder();
-        this.parser.parseAttribute(Unpooled.wrappedBuffer(ByteArray.cutBytes(clusterIdBytes, 3)), clusterIdOutput);
+        this.parser.parseAttribute(Unpooled.wrappedBuffer(ByteArray.cutBytes(CLUSTER_ID_BYTES, 3)), clusterIdOutput,
+            null);
         assertEquals(clusterId, clusterIdOutput.build());
     }
 
     @Test
     public void testParseEmptyListAttribute() {
-        final List<ClusterIdentifier> list = Lists.newArrayList();
-        final Attributes clusterId = new AttributesBuilder().setClusterId(new ClusterIdBuilder().setCluster
-            (list).build()).build();
+        final List<ClusterIdentifier> list = new ArrayList<>();
+        final Attributes clusterId = new AttributesBuilder().setClusterId(new ClusterIdBuilder().setCluster(list)
+            .build()).build();
         final ByteBuf output = Unpooled.buffer();
         this.parser.serializeAttribute(clusterId, output);
         assertEquals(Unpooled.buffer(), output);