Skip to content

Commit

Permalink
2369 add caching
Browse files Browse the repository at this point in the history
  • Loading branch information
Elena Moshnikova committed Nov 17, 2024
1 parent a872c88 commit 446f4c6
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/test/kotlin/com/epam/brn/service/ExerciseGroupServiceTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith
import java.util.Optional
import kotlin.test.assertFailsWith
import org.amshove.kluent.`should be`

@ExtendWith(MockKExtension::class)
internal class ExerciseGroupServiceTest {
Expand Down Expand Up @@ -50,6 +51,21 @@ internal class ExerciseGroupServiceTest {
assertEquals(actualResult, exerciseGroupMock)
}

@Test
fun `should get group by locale if it's exists`() {
// GIVEN
val locale = "ru-ru"
val exerciseGroupMock =
ExerciseGroup(id = 1, code = "groupCode", locale = "ru-ru", name = "name", description = "descr")
every { exerciseGroupRepository.findByLocale(locale) } returns listOf(exerciseGroupMock)
// WHEN
val actualResult: List<ExerciseGroupDto> = exerciseGroupsService.findByLocale(locale)
// THEN
actualResult.isNotEmpty()
actualResult.first().id `should be` 1
actualResult.first().locale `should be` "ru-ru"
}

@Test
fun `should throw error when find group by not exist code`() {
// GIVEN
Expand Down

0 comments on commit 446f4c6

Please sign in to comment.