mirror of
https://github.com/corda/corda.git
synced 2025-06-18 15:18:16 +00:00
CORDA-3175 Remove dependency on 3rd party javax.xml.bind library for simple hex parsing/printing. (#5412)
* Remove dependency on 2rd party javax.xml.bind library for simple hex parsing/printing. * Added unit test.
This commit is contained in:
@ -1,7 +1,10 @@
|
||||
package net.corda.core.utilities
|
||||
|
||||
import net.corda.core.contracts.StateRef
|
||||
import net.corda.core.crypto.SecureHash
|
||||
import net.corda.core.internal.declaredField
|
||||
import org.assertj.core.api.Assertions.catchThrowable
|
||||
import org.junit.Assert
|
||||
import org.junit.Assert.assertSame
|
||||
import org.junit.Test
|
||||
import java.nio.ByteBuffer
|
||||
@ -42,4 +45,17 @@ class ByteArraysTest {
|
||||
check(byteArrayOf(), seq.slice(2, 2))
|
||||
check(byteArrayOf(), seq.slice(2, 1))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test hex parsing strictly uppercase`() {
|
||||
val HEX_REGEX = "^[0-9A-F]+\$".toRegex()
|
||||
|
||||
val privacySalt = net.corda.core.contracts.PrivacySalt()
|
||||
val privacySaltAsHexString = privacySalt.bytes.toHexString()
|
||||
Assert.assertTrue(privacySaltAsHexString.matches(HEX_REGEX))
|
||||
|
||||
val stateRef = StateRef(SecureHash.randomSHA256(), 0)
|
||||
val txhashAsHexString = stateRef.txhash.bytes.toHexString()
|
||||
Assert.assertTrue(txhashAsHexString.matches(HEX_REGEX))
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user