Skip to content

Commit cf82aa2

Browse files
committed
Fixes potential bug in StatsVMTest
1 parent d242832 commit cf82aa2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

app/src/test/java/com/example/android/architecture/blueprints/todoapp/statistics/StatisticsViewModelTest.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class StatisticsViewModelTest {
4444
private lateinit var statisticsViewModel: StatisticsViewModel
4545

4646
// Use a fake repository to be injected into the viewmodel
47-
private val tasksRepository = FakeRepository()
47+
private lateinit var tasksRepository: FakeRepository
4848

4949
// Set the main coroutines dispatcher for unit testing.
5050
@ExperimentalCoroutinesApi
@@ -53,6 +53,8 @@ class StatisticsViewModelTest {
5353

5454
@Before
5555
fun setupStatisticsViewModel() {
56+
tasksRepository = FakeRepository()
57+
5658
statisticsViewModel = StatisticsViewModel(tasksRepository)
5759
}
5860

0 commit comments

Comments
 (0)