fromJsonTo calls throw, they should always be wrapped if we want null results.
This commit is contained in:
+1
-1
@@ -91,7 +91,7 @@ class NotificationTest {
|
|||||||
@Test
|
@Test
|
||||||
fun testUnknownNotificationTypeReturnsNull() {
|
fun testUnknownNotificationTypeReturnsNull() {
|
||||||
val json = """{"notification_type":"unknown_type","notification":{}}"""
|
val json = """{"notification_type":"unknown_type","notification":{}}"""
|
||||||
val notification = OptimizedJsonMapper.fromJsonTo<Notification>(json)
|
val notification = runCatching { OptimizedJsonMapper.fromJsonTo<Notification>(json) }.getOrNull()
|
||||||
assertNull(notification)
|
assertNull(notification)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user