Updated on 2026-08-14
This commit is contained in:
parent
5cd82605ce
commit
560301be14
5 changed files with 30 additions and 24 deletions
|
|
@ -116,18 +116,26 @@ class TlvMapperTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `map ProductMask returns correct value`() {
|
||||
val localMapper = TlvMapper(listOf(Tlv(TlvTag.ProductMask, byteArrayOf(4))))
|
||||
fun `map ProductMask with raw value 5 returns correct value`() {
|
||||
val localMapper = TlvMapper(listOf(Tlv(TlvTag.ProductMask, byteArrayOf(5))))
|
||||
val productMask: ProductMask = localMapper.map(TlvTag.ProductMask)
|
||||
assertThat(productMask)
|
||||
.isEqualTo(ProductMask.Card)
|
||||
assertThat(productMask.contains(ProductMask.note) && productMask.contains(ProductMask.idCard))
|
||||
.isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `map ProductMask with raw value 1 returns correct value`() {
|
||||
val localMapper = TlvMapper(listOf(Tlv(TlvTag.ProductMask, byteArrayOf(1))))
|
||||
val productMask: ProductMask = localMapper.map(TlvTag.ProductMask)
|
||||
assertThat(productMask.contains(ProductMask.note))
|
||||
.isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `map Enum with unknown code throws ConversionException error`() {
|
||||
val localMapper = TlvMapper(listOf(Tlv(TlvTag.ProductMask, byteArrayOf(5))))
|
||||
val localMapper = TlvMapper(listOf(Tlv(TlvTag.CurveId, "test".toByteArray())))
|
||||
assertThrows<TaskError.ConvertError> {
|
||||
localMapper.map<ProductMask>(TlvTag.ProductMask)
|
||||
localMapper.map<EllipticCurve>(TlvTag.CurveId)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue