Skip to content

Commit

Permalink
Make QoSErrorTest more flexible
Browse files Browse the repository at this point in the history
  • Loading branch information
MGaetan89 committed Jun 19, 2024
1 parent 7725336 commit 03ee04a
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package ch.srgssr.pillarbox.player.qos
import java.lang.RuntimeException
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue
import kotlin.time.Duration.Companion.minutes
import kotlin.time.Duration.Companion.seconds

Expand All @@ -22,8 +23,9 @@ class QoSErrorTest {

val logLines = qosError.log.lineSequence()

assertEquals(42, logLines.count())
assertTrue(logLines.count() > 1, "Expected log to contain the stacktrace")
assertEquals("java.lang.IllegalStateException", logLines.first())
assertTrue(logLines.none { it.startsWith("Caused by: ") }, "Expected log to not contain a cause")
assertEquals("", qosError.message)
assertEquals("IllegalStateException", qosError.name)
assertEquals(QoSError.Severity.WARNING, qosError.severity)
Expand All @@ -41,8 +43,12 @@ class QoSErrorTest {

val logLines = qosError.log.lineSequence()

assertEquals(45, logLines.count())
assertTrue(logLines.count() > 1, "Expected log to contain the stacktrace")
assertEquals("java.lang.RuntimeException: ${throwable.message}", logLines.first())
assertTrue(
logLines.any { it == "Caused by: java.lang.NullPointerException: ${cause.message}" },
"Expected log to contain a cause",
)
assertEquals(throwable.message, qosError.message)
assertEquals("RuntimeException", qosError.name)
assertEquals(QoSError.Severity.FATAL, qosError.severity)
Expand Down

0 comments on commit 03ee04a

Please sign in to comment.