@@ -6,10 +6,14 @@ import dartzee.helper.insertPlayer
66import dartzee.logging.CODE_AUDIO_ERROR
77import dartzee.logging.Severity
88import dartzee.preferences.Preferences
9+ import dartzee.screen.animation.IAnimation
10+ import dartzee.screen.animation.IAnimationTrigger
911import dartzee.utils.InjectedThings
1012import dartzee.utils.InjectedThings.preferenceService
1113import dartzee.utils.ResourceCache
14+ import io.kotest.assertions.withClue
1215import io.kotest.matchers.shouldBe
16+ import io.kotest.matchers.shouldNotBe
1317import io.mockk.every
1418import io.mockk.mockk
1519import io.mockk.mockkStatic
@@ -21,7 +25,6 @@ import java.time.Month
2125import javax.sound.sampled.AudioInputStream
2226import javax.sound.sampled.AudioSystem
2327import javax.swing.ImageIcon
24- import org.junit.jupiter.api.Assertions.fail
2528import org.junit.jupiter.api.Test
2629
2730class ThemeUtilsTest : AbstractTest () {
@@ -59,24 +62,28 @@ class ThemeUtilsTest : AbstractTest() {
5962 @Test
6063 fun `all referenced animation resources should exist` () {
6164 themeMap().values.forEach { theme ->
62- theme.animations.forEach { (trigger, animation) ->
63- animation.getAllSounds().forEach { sound ->
64- val result = javaClass.getResource(" /wav/$sound .wav" )
65- if (result == null ) {
66- fail(" Wav $sound not found for trigger $trigger and theme ${theme.name} " )
67- }
68- }
69-
70- animation.getAllImages().forEach { img ->
71- val result = javaClass.getResource(img)
72- if (result == null ) {
73- fail(" Image $img not found for trigger $trigger and theme ${theme.name} " )
74- }
75- }
65+ withClue(" All assets should exist for ${theme.name} " ) {
66+ theme.animations.forEach(::assertAllAssetsExistForAnimations)
7667 }
7768 }
7869 }
7970
71+ private fun assertAllAssetsExistForAnimations (
72+ animationEntry : Map .Entry <IAnimationTrigger , IAnimation >
73+ ) {
74+ val (trigger, animation) = animationEntry
75+
76+ animation.getAllSounds().forEach { sound ->
77+ val result = javaClass.getResource(" /wav/$sound .wav" )
78+ withClue(" Wav $sound should exist for trigger $trigger " ) { result shouldNotBe null }
79+ }
80+
81+ animation.getAllImages().forEach { img ->
82+ val result = javaClass.getResource(img)
83+ withClue(" Image $img should exist for trigger $trigger " ) { result shouldNotBe null }
84+ }
85+ }
86+
8087 @Test
8188 fun `themedIcon should return default icon if theme path not found (no override exists)` () {
8289 InjectedThings .now = LocalDate .of(2027 , Month .JANUARY , 1 )
0 commit comments