fix tests unable to compile

This commit is contained in:
brreynie 2023-05-10 09:59:17 +02:00
parent 3c1bc9bb1b
commit efd92ce832

View file

@ -1,9 +1,13 @@
package be.ugent.sel.studeez.timer_functional package be.ugent.sel.studeez.timer_functional
import android.media.MediaPlayer import android.media.MediaPlayer
import be.ugent.sel.studeez.data.SelectedSessionReport
import be.ugent.sel.studeez.data.SelectedTimer
import be.ugent.sel.studeez.data.local.models.timer_functional.FunctionalCustomTimer import be.ugent.sel.studeez.data.local.models.timer_functional.FunctionalCustomTimer
import be.ugent.sel.studeez.data.local.models.timer_functional.FunctionalEndlessTimer import be.ugent.sel.studeez.data.local.models.timer_functional.FunctionalEndlessTimer
import be.ugent.sel.studeez.data.local.models.timer_functional.FunctionalPomodoroTimer import be.ugent.sel.studeez.data.local.models.timer_functional.FunctionalPomodoroTimer
import be.ugent.sel.studeez.domain.LogService
import be.ugent.sel.studeez.domain.implementation.LogServiceImpl
import be.ugent.sel.studeez.screens.session.InvisibleSessionManager import be.ugent.sel.studeez.screens.session.InvisibleSessionManager
import be.ugent.sel.studeez.screens.session.SessionViewModel import be.ugent.sel.studeez.screens.session.SessionViewModel
import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.ExperimentalCoroutinesApi
@ -16,14 +20,14 @@ import org.mockito.kotlin.mock
@ExperimentalCoroutinesApi @ExperimentalCoroutinesApi
class InvisibleSessionManagerTest { class InvisibleSessionManagerTest {
private var timerState: SelectedTimer = SelectedTimer() private var selectedTimer: SelectedTimer = SelectedTimer()
private lateinit var viewModel: SessionViewModel private lateinit var viewModel: SessionViewModel
private var mediaPlayer: MediaPlayer = mock() private var mediaPlayer: MediaPlayer = mock()
@Test @Test
fun InvisibleEndlessTimerTest() = runTest { fun InvisibleEndlessTimerTest() = runTest {
timerState.selectedTimer = FunctionalEndlessTimer() selectedTimer.set(FunctionalEndlessTimer())
viewModel = SessionViewModel(timerState, SessionReport(), mock()) viewModel = SessionViewModel(selectedTimer, SelectedSessionReport(), mock(), LogServiceImpl())
InvisibleSessionManager.setParameters(viewModel, mediaPlayer) InvisibleSessionManager.setParameters(viewModel, mediaPlayer)
val test = launch { val test = launch {
@ -44,8 +48,8 @@ class InvisibleSessionManagerTest {
val studyTime = 10 val studyTime = 10
val breakTime = 5 val breakTime = 5
val repeats = 1 val repeats = 1
timerState.selectedTimer = FunctionalPomodoroTimer(studyTime, breakTime, repeats) selectedTimer.set(FunctionalPomodoroTimer(studyTime, breakTime, repeats))
viewModel = SessionViewModel(timerState, SessionReport(), mock()) viewModel = SessionViewModel(selectedTimer, SelectedSessionReport(), mock(), LogServiceImpl())
InvisibleSessionManager.setParameters(viewModel, mediaPlayer) InvisibleSessionManager.setParameters(viewModel, mediaPlayer)
val test = launch { val test = launch {
@ -77,8 +81,8 @@ class InvisibleSessionManagerTest {
@Test @Test
fun InvisibleCustomTimerTest() = runTest { fun InvisibleCustomTimerTest() = runTest {
timerState.selectedTimer = FunctionalCustomTimer(5) selectedTimer.set(FunctionalCustomTimer(5))
viewModel = SessionViewModel(timerState, SessionReport(), mock()) viewModel = SessionViewModel(selectedTimer, SelectedSessionReport(), mock(), LogServiceImpl())
InvisibleSessionManager.setParameters(viewModel, mediaPlayer) InvisibleSessionManager.setParameters(viewModel, mediaPlayer)
val test = launch { val test = launch {