From 6a759f065b6f501149aa52649b73625469397cde Mon Sep 17 00:00:00 2001 From: Elena Moshnikova Date: Wed, 23 Oct 2024 10:25:32 +0300 Subject: [PATCH] refactor delete extra code --- .../service/YandexSpeechKitServiceIT.kt | 2 +- .../brn/service/YandexSpeechKitServiceTest.kt | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/test/kotlin/com/epam/brn/integration/service/YandexSpeechKitServiceIT.kt b/src/test/kotlin/com/epam/brn/integration/service/YandexSpeechKitServiceIT.kt index 8b1bc79cc..0b6bf66f7 100644 --- a/src/test/kotlin/com/epam/brn/integration/service/YandexSpeechKitServiceIT.kt +++ b/src/test/kotlin/com/epam/brn/integration/service/YandexSpeechKitServiceIT.kt @@ -39,7 +39,7 @@ internal class YandexSpeechKitServiceIT { } @Test - fun `should generate ogg audio file`() { + fun `should generate ogg audio stream with validation`() { val locale = BrnLocale.RU.locale val voice = Voice.OKSANA.name val speed = "1" diff --git a/src/test/kotlin/com/epam/brn/service/YandexSpeechKitServiceTest.kt b/src/test/kotlin/com/epam/brn/service/YandexSpeechKitServiceTest.kt index 17e77005c..a7c718f6d 100644 --- a/src/test/kotlin/com/epam/brn/service/YandexSpeechKitServiceTest.kt +++ b/src/test/kotlin/com/epam/brn/service/YandexSpeechKitServiceTest.kt @@ -37,4 +37,24 @@ internal class YandexSpeechKitServiceTest { // WHEN assertThrows { yandexSpeechKitService.validateLocaleAndVoice(locale, "") } } + + @ParameterizedTest + @ValueSource(strings = ["FILIPP", "NICK"]) + fun `should success pass voice validation without Exceptions`(voice: String) { + val yandexVoices = listOf("FILIPP", "NICK") + every { timeService.now() } returns LocalDateTime.now() + every { wordsService.getVoicesForLocale("ru-ru") } returns yandexVoices + // WHEN + yandexSpeechKitService.validateLocaleAndVoice("ru-ru", voice) + } + + @ParameterizedTest + @ValueSource(strings = ["ddd", "rrr"]) + fun `should failed on voice validation`(voice: String) { + val yandexVoices = listOf("FILIPP", "NICK") + every { timeService.now() } returns LocalDateTime.now() + every { wordsService.getVoicesForLocale("ru-ru") } returns yandexVoices + // WHEN + assertThrows { yandexSpeechKitService.validateLocaleAndVoice("ru-ru", voice) } + } }