Skip to content

Commit

Permalink
test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
mrFlick72 committed Nov 18, 2024
1 parent df4fe43 commit c01669f
Showing 1 changed file with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,31 @@
package com.vauthenticator.server.keys.adapter.java

//todo
class KeyGeneratorMasterKeyRepositoryTest
import com.vauthenticator.server.keys.domain.MasterKid
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertThrows
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test

class KeyGeneratorMasterKeyRepositoryTest {

lateinit var uut: KeyGeneratorMasterKeyRepository

@BeforeEach
fun setUp() {
uut = KeyGeneratorMasterKeyRepository(KeyGeneratorMasterKeyStorage(mapOf("a_key" to "a_value")))
}


@Test
fun `when a key is retrieved`() {
val expected = "a_value"
val actual = uut.maskerKeyFor(MasterKid("a_key"))
assertEquals(expected, actual)
}


@Test
fun `when get a key from the storage fails`() {
assertThrows(NullPointerException::class.java) { uut.maskerKeyFor(MasterKid("a_key_2")) }
}
}

0 comments on commit c01669f

Please sign in to comment.