Add simple hex utils that delegate to Netty
The goal is to use libraries for this sort of common stuff
This commit is contained in:
22
src/test/java/tools/HexToolTest.java
Normal file
22
src/test/java/tools/HexToolTest.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package tools;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
class HexToolTest {
|
||||
|
||||
@Test
|
||||
void upperCaseHexToBytesAndBack() {
|
||||
String hex = "A1B2C3";
|
||||
byte[] bytes = HexTool.hexToBytes(hex);
|
||||
assertEquals(hex, HexTool.bytesToHex(bytes));
|
||||
}
|
||||
|
||||
@Test
|
||||
void mixedCaseHexToBytesAndBack() {
|
||||
String hex = "aB5DaA";
|
||||
byte[] bytes = HexTool.hexToBytes(hex);
|
||||
assertEquals(hex.toUpperCase(), HexTool.bytesToHex(bytes));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user