Skip to content

Commit

Permalink
Fix json test
Browse files Browse the repository at this point in the history
  • Loading branch information
StaehliJ committed Apr 25, 2024
1 parent 2a57939 commit 05b48bb
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@ import kotlin.test.assertNotNull
class TestJsonSerialization {
@Test
fun testChapterValidJson() {
val json = "{\"urn\":\"urn:srf:video:12343\",\"title\":\"Chapter title\",\"imageUrl\":\"https://image.png\",\"blockReason\": \"UNKNOWN\"}"
val json = "{\"urn\":\"urn:srf:video:12343\",\"title\":\"Chapter title\",\"imageUrl\":\"https://image.png\",\"blockReason\": \"UNKNOWN\"," +
"\"mediaType\": \"VIDEO\"}"
val chapter = jsonSerializer.decodeFromString<Chapter>(json)
assertNotNull(chapter)
assertEquals(BlockReason.UNKNOWN, chapter.blockReason)
}

@Test(expected = SerializationException::class)
fun testChapterValidJsonUnknownBlockreason() {
val json = "{\"urn\":\"urn:srf:video:12343\",\"title\":\"Chapter title\",\"imageUrl\":\"https://image.png\",\"blockReason\": \"TOTO\"}"
val json = "{\"urn\":\"urn:srf:video:12343\",\"title\":\"Chapter title\",\"imageUrl\":\"https://image.png\",\"blockReason\": \"TOTO\"," +
"\"mediaType\": \"VIDEO\"}"
val chapter = jsonSerializer.decodeFromString<Chapter>(json)
assertNotNull(chapter)
assertNotNull(chapter.blockReason)
Expand Down Expand Up @@ -58,7 +60,8 @@ class TestJsonSerialization {
{
"urn": "urn:srf:video:12343",
"title": "Chapter title",
"imageUrl": "https://image.png"
"imageUrl": "https://image.png",
"mediaType": "VIDEO"
}
]
}
Expand Down

0 comments on commit 05b48bb

Please sign in to comment.