Convert JobDatabase to Kotlin.

This commit is contained in:
Greyson Parrelli
2023-08-28 18:41:42 -04:00
parent 8339c0d8de
commit 9a7d8c858d
5 changed files with 458 additions and 440 deletions

View File

@@ -530,17 +530,17 @@ class FastJobStorageTest {
private fun noopDatabase(): JobDatabase {
val database = Mockito.mock(JobDatabase::class.java)
Mockito.`when`(database.allJobSpecs).thenReturn(emptyList())
Mockito.`when`(database.allConstraintSpecs).thenReturn(emptyList())
Mockito.`when`(database.allDependencySpecs).thenReturn(emptyList())
Mockito.`when`(database.getAllJobSpecs()).thenReturn(emptyList())
Mockito.`when`(database.getAllConstraintSpecs()).thenReturn(emptyList())
Mockito.`when`(database.getAllDependencySpecs()).thenReturn(emptyList())
return database
}
private fun fixedDataDatabase(fullSpecs: List<FullSpec>): JobDatabase {
val database = Mockito.mock(JobDatabase::class.java)
Mockito.`when`(database.allJobSpecs).thenReturn(fullSpecs.map { it.jobSpec })
Mockito.`when`(database.allConstraintSpecs).thenReturn(fullSpecs.map { it.constraintSpecs }.flatten())
Mockito.`when`(database.allDependencySpecs).thenReturn(fullSpecs.map { it.dependencySpecs }.flatten())
Mockito.`when`(database.getAllJobSpecs()).thenReturn(fullSpecs.map { it.jobSpec })
Mockito.`when`(database.getAllConstraintSpecs()).thenReturn(fullSpecs.map { it.constraintSpecs }.flatten())
Mockito.`when`(database.getAllDependencySpecs()).thenReturn(fullSpecs.map { it.dependencySpecs }.flatten())
return database
}