*/
package org.opendaylight.lispflowmapping.serializer.address;
+import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import java.nio.ByteBuffer;
-import junitx.framework.ArrayAssert;
import org.junit.Test;
import org.opendaylight.lispflowmapping.lisp.serializer.address.LispAddressSerializer;
import org.opendaylight.lispflowmapping.lisp.serializer.exception.LispSerializationException;
+ "00 01 11 22 33 44 " // AFI=1, IP=0x11223344
+ "00 01 22 33 44 55"), null); // AFI=1, IP=0x22334455
- assertEquals(KeyValueAddressLcaf.class, address.getAddressType());
+ assertEquals(KeyValueAddressLcaf.VALUE, address.getAddressType());
KeyValueAddress srcDestAddress = (KeyValueAddress) address.getAddress();
assertEquals("17.34.51.68", srcDestAddress.getKeyValueAddress().getKey().stringValue());
@Test(expected = LispSerializationException.class)
public void deserialize__ShorterBuffer() throws Exception {
- LispAddressSerializer.getInstance().deserializeEid(hexToByteBuffer("40 03 00 00 "
- + "02 20 00 0A "
- + "AA BB "), null);
+ LispAddressSerializer.getInstance().deserializeEid(hexToByteBuffer("""
+ 40 03 00 00 \
+ 02 20 00 0A \
+ AA BB \
+ """), null);
}
@Test(expected = LispSerializationException.class)
public void deserialize__UnknownLCAFType() throws Exception {
- LispAddressSerializer.getInstance().deserializeEid(hexToByteBuffer("40 03 00 00 "
- + "AA 20 00 0A " // Type AA is unknown
- + "00 01 11 22 33 44 " // AFI=1, IP=0x11223344
- + "00 01 22 33 44 55"), null); // AFI=1, IP=0x22334455
+ LispAddressSerializer.getInstance().deserializeEid(hexToByteBuffer("""
+ 40 03 00 00 \
+ AA 20 00 0A \
+ 00 01 11 22 33 44 \
+ 00 01 22 33 44 55"""), null); // AFI=1, IP=0x22334455
}
@Test
addressBuilder.setValue(new SimpleAddress(new IpAddress(new Ipv4Address("34.51.68.85"))));
EidBuilder eb = new EidBuilder();
- eb.setAddressType(KeyValueAddressLcaf.class);
+ eb.setAddressType(KeyValueAddressLcaf.VALUE);
eb.setVirtualNetworkId(null);
eb.setAddress(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105
.lisp.address.address.KeyValueAddressBuilder()
+ "0F 00 00 0C "
+ "00 01 11 22 33 44 " // AFI=1, IP=0x11223344
+ "00 01 22 33 44 55"); // AFI=1, IP=0x22334455
- ArrayAssert.assertEquals(expectedBuf.array(), buf.array());
+ assertArrayEquals(expectedBuf.array(), buf.array());
}
}