2 * Copyright (c) 2023 PANTHEON.tech s.r.o. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.lispflowmapping;
10 import static org.junit.Assert.assertEquals;
12 import java.nio.ByteBuffer;
14 public final class TestUtils {
20 public static ByteBuffer hexToByteBuffer(String hex) {
21 String[] hexBytes = hex.split(" ");
22 ByteBuffer bb = ByteBuffer.allocate(hexBytes.length);
23 for (String hexByte : hexBytes) {
24 bb.put((byte) Integer.parseInt(hexByte, 16));
30 public static void assertHexEquals(short expected, short actual) {
31 assertEquals(String.format("0x%04X", expected), String.format("0x%04X", actual));
34 public static void assertHexEquals(byte expected, byte actual) {
35 assertEquals(String.format("0x%02X", expected), String.format("0x%02X", actual));