Remove use of junit-addons
[lispflowmapping.git] / mappingservice / lisp-proto / src / test / java / org / opendaylight / lispflowmapping / lisp / authentication / LispAuthenticationTest.java
index 3b042f1e507b7c84d041b2a8efebf30ee90a9f17..7daabcc7bee3f659bd1ec9532bc7befdefeae13f 100644 (file)
@@ -7,12 +7,12 @@
  */
 package org.opendaylight.lispflowmapping.lisp.authentication;
 
+import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
-import junitx.framework.ArrayAssert;
 import org.junit.Test;
 import org.opendaylight.lispflowmapping.lisp.serializer.MapNotifySerializer;
 import org.opendaylight.lispflowmapping.lisp.serializer.MapRegisterSerializer;
@@ -22,11 +22,12 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.Ma
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.locatorrecords.LocatorRecord;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapnotifymessage.MapNotifyBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping._record.container.MappingRecordBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping._record.list.MappingRecordItem;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping._record.list.MappingRecordItemBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkeyBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecordBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.list.MappingRecordItem;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.list.MappingRecordItemBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
 
 public class LispAuthenticationTest extends BaseTestCase {
     private static final String PASSWORD = "password";
@@ -53,7 +54,7 @@ public class LispAuthenticationTest extends BaseTestCase {
                         + "ff 00 00 05 00 01 c0 a8 88 0a");
         MapRegister mapRegister = MapRegisterSerializer.getInstance().deserialize(byteBuffer, null);
 
-        assertFalse(validate(mapRegister, byteBuffer, EID, 1, PASSWORD));
+        assertFalse(validate(mapRegister, byteBuffer, EID, Uint16.ONE, PASSWORD));
     }
 
     @Test
@@ -75,8 +76,8 @@ public class LispAuthenticationTest extends BaseTestCase {
                 + "ff 00 00 05 00 01 c0 a8 88 0a");
         MapRegister mapRegister = MapRegisterSerializer.getInstance().deserialize(byteBuffer, null);
 
-        assertTrue(validate(mapRegister, byteBuffer, EID, 1, PASSWORD));
-        assertFalse(validate(mapRegister, byteBuffer, EID, 1, WRONG_PASSWORD));
+        assertTrue(validate(mapRegister, byteBuffer, EID, Uint16.ONE, PASSWORD));
+        assertFalse(validate(mapRegister, byteBuffer, EID, Uint16.ONE, WRONG_PASSWORD));
     }
 
     @Test
@@ -104,8 +105,8 @@ public class LispAuthenticationTest extends BaseTestCase {
                 .getInstance()
                 .deserialize(byteBuffer, null);
 
-        assertTrue(validate(mapRegister, byteBuffer, EID, 2, PASSWORD));
-        assertFalse(validate(mapRegister, byteBuffer, EID, 2, WRONG_PASSWORD));
+        assertTrue(validate(mapRegister, byteBuffer, EID, Uint16.TWO, PASSWORD));
+        assertFalse(validate(mapRegister, byteBuffer, EID, Uint16.TWO, WRONG_PASSWORD));
     }
 
     @Test
@@ -127,8 +128,8 @@ public class LispAuthenticationTest extends BaseTestCase {
                 + "ff 00 00 05 00 01 c0 a8 88 0a");
         MapRegister mapRegister = MapRegisterSerializer.getInstance().deserialize(byteBuffer, null);
 
-        assertTrue(validate(mapRegister, byteBuffer, EID, 0, PASSWORD));
-        assertTrue(validate(mapRegister, byteBuffer, EID, 0, WRONG_PASSWORD));
+        assertTrue(validate(mapRegister, byteBuffer, EID, Uint16.ZERO, PASSWORD));
+        assertTrue(validate(mapRegister, byteBuffer, EID, Uint16.ZERO, WRONG_PASSWORD));
     }
 
     // @Test
@@ -186,13 +187,13 @@ public class LispAuthenticationTest extends BaseTestCase {
                 new MappingRecordItemBuilder().setMappingRecord(etlrBuilder.build()).setMappingRecordItemId("xyzzy")
                     .build());
         final ByteBuffer serializedMapNotifyMsg = MapNotifySerializer.getInstance().serialize(mapNotifyBuilder.build());
-        ArrayAssert.assertEquals(new byte[0], LispAuthenticationUtil.createAuthenticationData(serializedMapNotifyMsg,
+        assertArrayEquals(new byte[0], LispAuthenticationUtil.createAuthenticationData(serializedMapNotifyMsg,
                 "password"));
 
     }
 
-    private static boolean validate(MapRegister mapRegister, ByteBuffer byteBuffer, Eid eid, int keyId, String
-            password) {
+    private static boolean validate(final MapRegister mapRegister, final ByteBuffer byteBuffer, final Eid eid,
+            final Uint16 keyId, final String password) {
         MappingAuthkey key = new MappingAuthkeyBuilder().setKeyType(keyId).setKeyString(password).build();
         return LispAuthenticationUtil.validate(mapRegister,byteBuffer, eid, key);
     }