mirror of
https://gitee.com/san-bing/JChargePointProtocol
synced 2026-05-06 02:49:57 +08:00
云快充1.5.0 初始化
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* 抖音关注:程序员三丙
|
||||
* 知识星球:https://t.zsxq.com/j9b21
|
||||
*/
|
||||
package sanbing.jcpp.infrastructure.util.codec;
|
||||
|
||||
import cn.hutool.core.util.HexUtil;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||
|
||||
class BCDUtilTest {
|
||||
|
||||
@Test
|
||||
void toBytesTest() {
|
||||
String pileCodeHex = "20231212000010";
|
||||
|
||||
byte[] bytes = HexUtil.decodeHex(pileCodeHex);
|
||||
|
||||
String pileCode = BCDUtil.toString(bytes);
|
||||
|
||||
assert pileCodeHex.equals(pileCode);
|
||||
|
||||
byte[] pileCodeBytes = BCDUtil.toBytes(pileCodeHex);
|
||||
|
||||
assertArrayEquals(pileCodeBytes, bytes);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* 抖音关注:程序员三丙
|
||||
* 知识星球:https://t.zsxq.com/j9b21
|
||||
*/
|
||||
package sanbing.jcpp.infrastructure.util.codec;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Arrays;
|
||||
|
||||
class CP56Time2aUtilTest {
|
||||
|
||||
@Test
|
||||
void encodeTest() {
|
||||
Instant time = Instant.ofEpochMilli(1727798453000L);
|
||||
|
||||
byte[] bytes = CP56Time2aUtil.encode(time);
|
||||
|
||||
System.out.println(Arrays.toString(bytes));
|
||||
|
||||
Instant decode = CP56Time2aUtil.decode(bytes);
|
||||
|
||||
assert time.equals(decode);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user