mirror of
https://github.com/LamGC/ScalaBot.git
synced 2025-07-03 05:47:24 +00:00
refactor: 将十六进制转换代码迁移到 Kotlin.
将 ByteUtils 的实现改用 Kotlin 代码做, 移除 ByteUtils. 另外, 本次修改同时修正了方法名错误的问题(hax 改成 hex), 并补充了单元测试.
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
package net.lamgc.scalabot.util
|
||||
|
||||
import org.eclipse.aether.artifact.DefaultArtifact
|
||||
import org.junit.jupiter.api.Assertions.assertFalse
|
||||
import org.junit.jupiter.api.Assertions.assertTrue
|
||||
import org.junit.jupiter.api.Assertions.*
|
||||
import org.junit.jupiter.api.Test
|
||||
import java.nio.charset.StandardCharsets
|
||||
|
||||
internal class UtilsKtTest {
|
||||
|
||||
@ -16,4 +16,10 @@ internal class UtilsKtTest {
|
||||
.equalsArtifact(DefaultArtifact("com.example:demo-2:1.0.0-SNAPSHOT"))
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `bytes to hex`() {
|
||||
assertEquals("48656c6c6f20576f726c64", "Hello World".toByteArray(StandardCharsets.UTF_8).toHexString())
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user