Skip to content

Commit

Permalink
x
Browse files Browse the repository at this point in the history
  • Loading branch information
warnyul committed Mar 11, 2024
1 parent c6a2baf commit d4fc79e
Showing 1 changed file with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package tech.apter.junit.jupiter.robolectric.internal

import org.robolectric.ApkLoader
import org.robolectric.annotation.SQLiteMode
import org.robolectric.internal.AndroidSandbox
import org.robolectric.internal.ResourcesMode
import org.robolectric.internal.bytecode.ClassInstrumentor
import org.robolectric.internal.SandboxManager.SandboxBuilder
import org.robolectric.internal.bytecode.InstrumentationConfiguration
import org.robolectric.internal.bytecode.ShadowProviders
import org.robolectric.pluginapi.Sdk
import org.robolectric.plugins.SdkCollection
import org.robolectric.util.inject.Injector
import tech.apter.junit.jupiter.robolectric.internal.tools.TestUtil
import kotlin.test.Ignore
import kotlin.test.Test
Expand Down Expand Up @@ -66,23 +66,25 @@ class JUnit5RobolectricSandboxBuilderTest {

private fun subjectUnderTest(
action: JUnit5RobolectricSandboxBuilder.() -> Unit
): JUnit5RobolectricSandboxBuilder = JUnit5RobolectricSandboxBuilder(
ApkLoader(),
AndroidSandbox.TestEnvironmentSpec(),
ShadowProviders(emptyList()),
ClassInstrumentor(),
).apply(action)
): JUnit5RobolectricSandboxBuilder = Injector.Builder()
.bind(SandboxBuilder::class.java, JUnit5RobolectricSandboxBuilder::class.java)
.bind(SdkCollection::class.java, TestUtil.sdkCollection)
.build()
.getInstance(JUnit5RobolectricSandboxBuilder::class.java)
.apply(action)

companion object {
private fun createInstrumentationConfiguration() =
InstrumentationConfiguration.newBuilder().doNotAcquirePackage("java.")
InstrumentationConfiguration.newBuilder()
.doNotAcquirePackage("java.")
.doNotAcquirePackage("jdk.internal.")
.doNotAcquirePackage("sun.")
.doNotAcquirePackage("org.robolectric.annotation.")
.doNotAcquirePackage("org.robolectric.internal.")
.doNotAcquirePackage("org.robolectric.pluginapi.")
.doNotAcquirePackage("org.robolectric.util.")
.doNotAcquirePackage("org.junit")
.doNotAcquireClass(JUnit5RobolectricSandboxBuilder::class.java)
.build()
}
}

0 comments on commit d4fc79e

Please sign in to comment.