Skip to content

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/UnsignedNumbersTests.kt

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
66
import com.fasterxml.jackson.module.kotlin.readValue
77
import org.junit.jupiter.api.Test
88
import java.math.BigInteger
9-
import org.hamcrest.CoreMatchers.equalTo
10-
import org.hamcrest.MatcherAssert.assertThat
11-
import org.junit.jupiter.api.Assertions.assertThrows
9+
import org.junit.jupiter.api.Assertions.assertEquals
10+
import org.junit.jupiter.api.assertThrows
1211

1312
internal class UnsignedNumbersTests {
1413

@@ -18,76 +17,76 @@ internal class UnsignedNumbersTests {
1817
fun `test UByte`() {
1918
val json = mapper.writeValueAsString(UByte.MAX_VALUE)
2019
val deserialized = mapper.readValue<UByte>(json)
21-
assertThat(deserialized, equalTo(UByte.MAX_VALUE))
20+
assertEquals(UByte.MAX_VALUE, deserialized)
2221
}
2322

2423
@Test
2524
fun `test UByte overflow`() {
2625
val json = mapper.writeValueAsString(UByte.MAX_VALUE + 1u)
27-
assertThrows(InputCoercionException::class.java) { mapper.readValue<UByte>(json) }
26+
assertThrows<InputCoercionException> { mapper.readValue<UByte>(json) }
2827
}
2928

3029
@Test
3130
fun `test UByte underflow`() {
3231
val json = mapper.writeValueAsString(-1)
33-
assertThrows(InputCoercionException::class.java) { mapper.readValue<UByte>(json) }
32+
assertThrows<InputCoercionException> { mapper.readValue<UByte>(json) }
3433
}
3534

3635
@Test
3736
fun `test UShort`() {
3837
val json = mapper.writeValueAsString(UShort.MAX_VALUE)
3938
val deserialized = mapper.readValue<UShort>(json)
40-
assertThat(deserialized, equalTo(UShort.MAX_VALUE))
39+
assertEquals(UShort.MAX_VALUE, deserialized)
4140
}
4241

4342
@Test
4443
fun `test UShort overflow`() {
4544
val json = mapper.writeValueAsString(UShort.MAX_VALUE + 1u)
46-
assertThrows(InputCoercionException::class.java) { mapper.readValue<UShort>(json) }
45+
assertThrows<InputCoercionException> { mapper.readValue<UShort>(json) }
4746
}
4847

4948
@Test
5049
fun `test UShort underflow`() {
5150
val json = mapper.writeValueAsString(-1)
52-
assertThrows(InputCoercionException::class.java) { mapper.readValue<UShort>(json) }
51+
assertThrows<InputCoercionException> { mapper.readValue<UShort>(json) }
5352
}
5453

5554
@Test
5655
fun `test UInt`() {
5756
val json = mapper.writeValueAsString(UInt.MAX_VALUE)
5857
val deserialized = mapper.readValue<UInt>(json)
59-
assertThat(deserialized, equalTo(UInt.MAX_VALUE))
58+
assertEquals(UInt.MAX_VALUE, deserialized)
6059
}
6160

6261
@Test
6362
fun `test UInt overflow`() {
6463
val json = mapper.writeValueAsString(UInt.MAX_VALUE.toULong() + 1u)
65-
assertThrows(InputCoercionException::class.java) { mapper.readValue<UInt>(json) }
64+
assertThrows<InputCoercionException> { mapper.readValue<UInt>(json) }
6665
}
6766

6867
@Test
6968
fun `test UInt underflow`() {
7069
val json = mapper.writeValueAsString(-1)
71-
assertThrows(InputCoercionException::class.java) { mapper.readValue<UInt>(json) }
70+
assertThrows<InputCoercionException> { mapper.readValue<UInt>(json) }
7271
}
7372

7473
@Test
7574
fun `test ULong`() {
7675
val json = mapper.writeValueAsString(ULong.MAX_VALUE)
7776
val deserialized = mapper.readValue<ULong>(json)
78-
assertThat(deserialized, equalTo(ULong.MAX_VALUE))
77+
assertEquals(ULong.MAX_VALUE, deserialized)
7978
}
8079

8180
@Test
8281
fun `test ULong overflow`() {
8382
val value = BigInteger(ULong.MAX_VALUE.toString()) + BigInteger.ONE
8483
val json = mapper.writeValueAsString(value)
85-
assertThrows(InputCoercionException::class.java) { mapper.readValue<ULong>(json) }
84+
assertThrows<InputCoercionException> { mapper.readValue<ULong>(json) }
8685
}
8786

8887
@Test
8988
fun `test ULong underflow`() {
9089
val json = mapper.writeValueAsString(-1)
91-
assertThrows(InputCoercionException::class.java) { mapper.readValue<ULong>(json) }
90+
assertThrows<InputCoercionException> { mapper.readValue<ULong>(json) }
9291
}
9392
}

0 commit comments

Comments
 (0)