Skip to content
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

Use @BeforeClass for ContentSettingsManagerTest.beforeClass #5204

Merged
merged 1 commit into from
Dec 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.content.SharedPreferences
import org.junit.Assert
import org.junit.Assume
import org.junit.Before
import org.junit.BeforeClass
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Suite
Expand All @@ -22,24 +23,27 @@ class ContentSettingsManagerTest {
@RunWith(MockitoJUnitRunner::class)
class ExportTest {

private lateinit var preferences: SharedPreferences
private lateinit var newpipeDb: File
private lateinit var newpipeSettings: File

@Before
fun beforeClass() {
companion object {
private lateinit var newpipeDb: File
private lateinit var newpipeSettings: File

val dbPath = javaClass.classLoader?.getResource("settings/newpipe.db")?.file
val settingsPath = javaClass.classLoader?.getResource("settings/newpipe.settings")?.path
Assume.assumeNotNull(dbPath)
Assume.assumeNotNull(settingsPath)
@JvmStatic
@BeforeClass
fun setupFiles() {
val dbPath = ExportTest::class.java.classLoader?.getResource("settings/newpipe.db")?.file
val settingsPath = ExportTest::class.java.classLoader?.getResource("settings/newpipe.settings")?.path
Assume.assumeNotNull(dbPath)
Assume.assumeNotNull(settingsPath)

newpipeDb = File(dbPath!!)
newpipeSettings = File(settingsPath!!)
newpipeDb = File(dbPath!!)
newpipeSettings = File(settingsPath!!)
}
}

private lateinit var preferences: SharedPreferences

@Before
fun before() {
fun setupMocks() {
preferences = Mockito.mock(SharedPreferences::class.java, Mockito.withSettings().stubOnly())
}

Expand Down