Updated on 2026-08-14
This commit is contained in:
parent
c55736dbd4
commit
4e37c808c4
3 changed files with 3 additions and 3 deletions
|
|
@ -12,7 +12,7 @@ import kotlin.experimental.xor
|
|||
* Extension functions for [ByteArray].
|
||||
*/
|
||||
|
||||
fun ByteArray.toHexString(): String = joinToString("") { "%02x".format(it) }
|
||||
fun ByteArray.toHexString(): String = joinToString("") { "%02X".format(it) }
|
||||
|
||||
fun ByteArray.toUtf8(): String = String(this).removeSuffix("\u0000")
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ class ByteArrayExtensionsTest {
|
|||
|
||||
@Test
|
||||
fun `card Id to Hex String`() {
|
||||
val hex = "cb22000000027374"
|
||||
val hex = "CB22000000027374"
|
||||
val bytes = byteArrayOf(-53, 34, 0, 0, 0, 2, 115, 116)
|
||||
assertThat(bytes.toHexString())
|
||||
.matches(hex)
|
||||
|
|
|
|||
|
|
@ -187,6 +187,6 @@ class TlvDecoderTest {
|
|||
fun `map Hex returns correct value`() {
|
||||
val cardId: String = tlvMapper.decode(TlvTag.CardId)
|
||||
assertThat(cardId)
|
||||
.isEqualTo("cb22000000027374")
|
||||
.isEqualTo("CB22000000027374")
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue