Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Commit

Permalink
add test (#5197)
Browse files Browse the repository at this point in the history
Co-authored-by: Juraj Kusnier <jurajkusnier@users.noreply.github.com>
  • Loading branch information
chiljamgossow and jurajkusnier authored May 18, 2022
1 parent d15d7a7 commit b26a0ba
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import de.rki.coronawarnapp.dccreissuance.core.server.DccReissuanceServer
import de.rki.coronawarnapp.dccreissuance.core.server.data.DccReissuanceResponse
import de.rki.coronawarnapp.qrcode.handler.DccQrCodeHandler
import io.kotest.assertions.throwables.shouldNotThrow
import io.kotest.assertions.throwables.shouldNotThrowAny
import io.kotest.assertions.throwables.shouldThrow
import io.kotest.matchers.shouldBe
import io.mockk.MockKAnnotations
Expand All @@ -24,7 +25,6 @@ import io.mockk.coEvery
import io.mockk.coVerify
import io.mockk.impl.annotations.MockK
import io.mockk.just
import kotlinx.coroutines.test.runBlockingTest
import kotlinx.coroutines.test.runTest
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
Expand Down Expand Up @@ -215,7 +215,7 @@ class DccReissuerTest : BaseTest() {
}

@Test
fun `forwards errors`() = runBlockingTest {
fun `forwards errors`() = runTest {
val errorCode = DccReissuanceException.ErrorCode.DCC_RI_400
coEvery { dccReissuanceServer.requestDccReissuance(any(), any()) } throws DccReissuanceException(
errorCode = errorCode
Expand All @@ -226,6 +226,17 @@ class DccReissuerTest : BaseTest() {
}.errorCode shouldBe errorCode
}

@Test
fun `ignores already registered`() = runTest {
coEvery { dccQrCodeHandler.register(any()) } throws InvalidHealthCertificateException(
errorCode = InvalidHealthCertificateException.ErrorCode.ALREADY_REGISTERED
)

shouldNotThrowAny {
instance().startReissuance(certificateReissuance = certificateReissuance)
}
}

private fun instance() = DccReissuer(
dccReissuanceServer = dccReissuanceServer,
dccQrCodeExtractor = dccQrCodeExtractor,
Expand Down

0 comments on commit b26a0ba

Please sign in to comment.