Refactor: Provide manga parsers via DI

This commit is contained in:
Koitharu
2020-10-20 21:45:15 +03:00
parent 6f3ae19345
commit a5fba83510
24 changed files with 95 additions and 104 deletions

View File

@@ -9,18 +9,24 @@ import org.junit.runner.RunWith
import org.junit.runners.Parameterized
import org.koin.core.context.startKoin
import org.koin.dsl.module
import org.koin.test.KoinTest
import org.koin.test.get
import org.koitharu.kotatsu.core.model.MangaSource
import org.koitharu.kotatsu.core.parser.UserAgentInterceptor
import org.koitharu.kotatsu.core.prefs.SourceConfig
import org.koitharu.kotatsu.domain.MangaLoaderContext
import org.koitharu.kotatsu.domain.MangaProviderFactory
import org.koitharu.kotatsu.utils.AssertX
import java.util.concurrent.TimeUnit
@RunWith(Parameterized::class)
class RemoteRepositoryTest(source: MangaSource) {
class RemoteRepositoryTest(source: MangaSource) : KoinTest {
private val repo = MangaProviderFactory.create(source)
private val repo = try {
source.cls.getDeclaredConstructor(MangaLoaderContext::class.java)
.newInstance(get())
} catch (e: NoSuchMethodException) {
source.cls.newInstance()
}
@Test
fun list() {