package de.trainingstagebuch.app.utils

import de.trainingstagebuch.app.R
import org.junit.Assert.assertEquals
import org.junit.Test

class ErrorMessageFormatterTest {

    @Test
    fun `dynamicWithOptionalCode returns resource with code args`() {
        val text = ErrorMessageFormatter.dynamicWithOptionalCode("Fehler", "ERROR_X")
        assertEquals(R.string.error_dynamic_with_code, text.resId)
        assertEquals(listOf("Fehler", "ERROR_X"), text.args)
    }

    @Test
    fun `dynamicWithOptionalCode returns unknown fallback for blank message`() {
        val text = ErrorMessageFormatter.dynamicWithOptionalCode("   ", null)
        assertEquals(R.string.error_unknown, text.resId)
        assertEquals(emptyList<Any>(), text.args)
    }
}
