-
Notifications
You must be signed in to change notification settings - Fork 1
[ANDR-54] ANDR-70: Третий этап CreateQuizScreen. Логика + Тесты #100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ee34a34
ANDR-5: добавлен юзкейс
PanMobile 2c5dbf9
ANDR-5: Скрин маппер теперь маппит домейн в VO
PanMobile 9ec368e
ANDR-5: Юзкейс разделен на интерфейс и импл
PanMobile 73ad437
ANDR-5: Подключение юзкейса и маппера во вьюмодели
PanMobile 7375862
ANDR-5: Удаление лишних созданий корутин при изменении ввода юзера (и…
PanMobile 25a2a84
ANDR-5: Переименован файл теста маппера dataToDomain
PanMobile 98717db
ANDR-5: Новый тест файл для теста ScreenMapper'а
PanMobile 76dcb51
ANDR-5: Правки для ktlint
PanMobile 980613a
ANDR-5: Проставлен везде is для удобства
PanMobile 29d86bc
ANDR-5: Удалены ненужные файлы тестов (уже удаленные)
PanMobile c4a7762
ANDR-5: Параметризированные тесты вынесены наверх в самих классах тестов
PanMobile File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
...a/ru/yeahub/interview_trainer/impl/createQuiz/domain/GetSpecializationsListUseCaseImpl.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package ru.yeahub.interview_trainer.impl.createQuiz.domain | ||
|
|
||
| class GetSpecializationsListUseCaseImpl( | ||
| private val repository: CreateQuizRepositoryApi, | ||
| ) : GetSpecializationsUseCase { | ||
| override suspend fun invoke( | ||
| request: SpecializationsRequest, | ||
| ): DomainSpecializationListResponse = repository.getSpecializationsList(request = request) | ||
| } |
5 changes: 5 additions & 0 deletions
5
...main/java/ru/yeahub/interview_trainer/impl/createQuiz/domain/GetSpecializationsUseCase.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| package ru.yeahub.interview_trainer.impl.createQuiz.domain | ||
|
|
||
| interface GetSpecializationsUseCase { | ||
| suspend operator fun invoke(request: SpecializationsRequest): DomainSpecializationListResponse | ||
| } |
11 changes: 9 additions & 2 deletions
11
...n/java/ru/yeahub/interview_trainer/impl/createQuiz/presentation/CreateQuizScreenMapper.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
feature/interview-trainer/impl/src/test/java/test/CreateQuizScreenMapperTest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| package test | ||
|
|
||
| import org.junit.jupiter.api.Assertions | ||
| import org.junit.jupiter.params.ParameterizedTest | ||
| import org.junit.jupiter.params.provider.ArgumentsSource | ||
| import ru.yeahub.interview_trainer.impl.createQuiz.domain.DomainSpecialization | ||
| import ru.yeahub.interview_trainer.impl.createQuiz.presentation.CreateQuizScreenMapper | ||
| import ru.yeahub.interview_trainer.impl.createQuiz.presentation.CreateQuizState | ||
| import ru.yeahub.test.TestArgumentsProvider | ||
|
|
||
| class CreateQuizScreenMapperTest { | ||
|
|
||
| @ParameterizedTest | ||
| @ArgumentsSource(ArgumentsProvider::class) | ||
| fun getScreenStateTest( | ||
| testCase: CreateQuizScreenMapperTestCase, | ||
| ) { | ||
| val result = CreateQuizScreenMapper.getScreenState( | ||
| specializations = testCase.specializations, | ||
| selectedSpecializationId = testCase.selectedSpecializationId, | ||
| questionsCount = testCase.questionsCount | ||
| ) | ||
| Assertions.assertEquals(testCase.expectedResult, result) | ||
| } | ||
|
|
||
| object ScreenMapperExampleDataClasses { | ||
| val defaultDomainSpecial = DomainSpecialization( | ||
| id = 0L, | ||
| title = "default title num 0" | ||
| ) | ||
|
|
||
| val defaultDomainSpecialWithImage = DomainSpecialization( | ||
| id = 1L, | ||
| title = "default title num 1" | ||
| ) | ||
|
|
||
| val defaultDomainSpecialList = listOf( | ||
| defaultDomainSpecial, | ||
| defaultDomainSpecialWithImage | ||
| ) | ||
|
|
||
| val defaultVoSpecial = CreateQuizState.Loaded.VoSpecialization( | ||
| id = 0L, | ||
| title = "default title num 0" | ||
| ) | ||
|
|
||
| val defaultVoSpecialWithImage = CreateQuizState.Loaded.VoSpecialization( | ||
| id = 1L, | ||
| title = "default title num 1" | ||
| ) | ||
|
|
||
| val defaultLoadedState = CreateQuizState.Loaded( | ||
| specializations = listOf(defaultVoSpecial, defaultVoSpecialWithImage), | ||
| selectedSpecializationId = 0L, | ||
| questionsCount = 10 | ||
| ) | ||
|
|
||
| val loadedStateWithDifferentSelection = CreateQuizState.Loaded( | ||
| specializations = listOf(defaultVoSpecial, defaultVoSpecialWithImage), | ||
| selectedSpecializationId = 1L, | ||
| questionsCount = 5 | ||
| ) | ||
| } | ||
|
|
||
| data class CreateQuizScreenMapperTestCase( | ||
| val specializations: List<DomainSpecialization>, | ||
| val selectedSpecializationId: Long, | ||
| val questionsCount: Int, | ||
| val expectedResult: CreateQuizState.Loaded, | ||
| ) | ||
|
|
||
| class ArgumentsProvider : | ||
| TestArgumentsProvider<CreateQuizScreenMapperTestCase>() { | ||
| override fun testCases(): List<CreateQuizScreenMapperTestCase> = listOf( | ||
| CreateQuizScreenMapperTestCase( | ||
| specializations = ScreenMapperExampleDataClasses.defaultDomainSpecialList, | ||
| selectedSpecializationId = 0L, | ||
| questionsCount = 10, | ||
| expectedResult = ScreenMapperExampleDataClasses.defaultLoadedState | ||
| ), | ||
| CreateQuizScreenMapperTestCase( | ||
| specializations = ScreenMapperExampleDataClasses.defaultDomainSpecialList, | ||
| selectedSpecializationId = 1L, | ||
| questionsCount = 5, | ||
| expectedResult = ScreenMapperExampleDataClasses.loadedStateWithDifferentSelection | ||
| ) | ||
| ) | ||
| } | ||
| } | ||
62 changes: 0 additions & 62 deletions
62
...ure/selection-specializations/impl/src/test/java/test/SpecializationExampleDataClasses.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.