Merge pull request #5204 from XiangRongLin/fix_before_all
Use @BeforeClass for ContentSettingsManagerTest.beforeClass
This commit is contained in:
commit
28802805f8
|
@ -4,6 +4,7 @@ import android.content.SharedPreferences
|
||||||
import org.junit.Assert
|
import org.junit.Assert
|
||||||
import org.junit.Assume
|
import org.junit.Assume
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
|
import org.junit.BeforeClass
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
import org.junit.runners.Suite
|
import org.junit.runners.Suite
|
||||||
|
@ -22,24 +23,27 @@ class ContentSettingsManagerTest {
|
||||||
@RunWith(MockitoJUnitRunner::class)
|
@RunWith(MockitoJUnitRunner::class)
|
||||||
class ExportTest {
|
class ExportTest {
|
||||||
|
|
||||||
private lateinit var preferences: SharedPreferences
|
companion object {
|
||||||
private lateinit var newpipeDb: File
|
private lateinit var newpipeDb: File
|
||||||
private lateinit var newpipeSettings: File
|
private lateinit var newpipeSettings: File
|
||||||
|
|
||||||
@Before
|
@JvmStatic
|
||||||
fun beforeClass() {
|
@BeforeClass
|
||||||
|
fun setupFiles() {
|
||||||
val dbPath = javaClass.classLoader?.getResource("settings/newpipe.db")?.file
|
val dbPath = ExportTest::class.java.classLoader?.getResource("settings/newpipe.db")?.file
|
||||||
val settingsPath = javaClass.classLoader?.getResource("settings/newpipe.settings")?.path
|
val settingsPath = ExportTest::class.java.classLoader?.getResource("settings/newpipe.settings")?.path
|
||||||
Assume.assumeNotNull(dbPath)
|
Assume.assumeNotNull(dbPath)
|
||||||
Assume.assumeNotNull(settingsPath)
|
Assume.assumeNotNull(settingsPath)
|
||||||
|
|
||||||
newpipeDb = File(dbPath!!)
|
newpipeDb = File(dbPath!!)
|
||||||
newpipeSettings = File(settingsPath!!)
|
newpipeSettings = File(settingsPath!!)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private lateinit var preferences: SharedPreferences
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun before() {
|
fun setupMocks() {
|
||||||
preferences = Mockito.mock(SharedPreferences::class.java, Mockito.withSettings().stubOnly())
|
preferences = Mockito.mock(SharedPreferences::class.java, Mockito.withSettings().stubOnly())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue