Skip to content

Commit

Permalink
feat: bump robolectric to 4.14
Browse files Browse the repository at this point in the history
Closes #98
  • Loading branch information
JohannesPtaszyk committed Nov 17, 2024
1 parent 207d2d9 commit d660ddf
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 19 deletions.
4 changes: 2 additions & 2 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ task downloadAarDepsPlugin {
final url = from[i]
final targetFile = to[i]
try {
new URL(url).withInputStream { inputStream -> targetFile.withOutputStream { it << inputStream } }
URI.create(url).toURL().withInputStream { inputStream -> targetFile.withOutputStream { it << inputStream } }
} catch (IOException e) {
logger.debug("Error during downloading ${url.name}. Keep the stored version.\n$e")
logger.debug("Error during downloading ${url}. Keep the stored version.\n$e")
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jvmToolchainMin = "11"
jvmToolchain = "17"
kotlin = "2.0.21"
kover = "0.8.3"
robolectric = "4.13"
robolectric = "4.14"
robolectricExtensionGradlePlugin = "0.8.0"
# Use when bom also added to the dependencies
sources = "sources"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package tech.apter.junit.jupiter.robolectric.internal

import org.robolectric.ApkLoader
import org.robolectric.annotation.ResourcesMode
import org.robolectric.annotation.SQLiteMode
import org.robolectric.internal.AndroidSandbox
import org.robolectric.internal.ResourcesMode
import org.robolectric.internal.bytecode.ShadowProviders
import org.robolectric.pluginapi.Sdk
import java.util.concurrent.ThreadFactory
Expand All @@ -13,8 +12,7 @@ import java.util.concurrent.atomic.AtomicLong
internal class JUnit5RobolectricAndroidSandbox(
runtimeSdk: Sdk,
compileSdk: Sdk,
resourcesMode: ResourcesMode,
apkLoader: ApkLoader,
resourcesMode: ResourcesMode.Mode,
@Suppress("VisibleForTests")
testEnvironmentSpec: TestEnvironmentSpec,
sdkSandboxClassLoader: SdkSandboxClassLoader,
Expand All @@ -24,7 +22,6 @@ internal class JUnit5RobolectricAndroidSandbox(
runtimeSdk,
compileSdk,
resourcesMode,
apkLoader,
testEnvironmentSpec,
sdkSandboxClassLoader,
shadowProviders,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package tech.apter.junit.jupiter.robolectric.internal

import org.robolectric.ApkLoader
import org.robolectric.annotation.ResourcesMode
import org.robolectric.annotation.SQLiteMode
import org.robolectric.internal.AndroidSandbox
import org.robolectric.internal.AndroidSandbox.SdkSandboxClassLoader
import org.robolectric.internal.ResourcesMode
import org.robolectric.internal.SandboxManager
import org.robolectric.internal.bytecode.ClassInstrumentor
import org.robolectric.internal.bytecode.InstrumentationConfiguration
Expand All @@ -17,7 +16,6 @@ import javax.inject.Inject

internal class JUnit5RobolectricSandboxBuilder @Inject constructor(
private val testClassContainer: TestClassContainer,
private val apkLoader: ApkLoader,
@Suppress("VisibleForTests")
private val testEnvironmentSpec: AndroidSandbox.TestEnvironmentSpec,
private val shadowProviders: ShadowProviders,
Expand All @@ -29,7 +27,7 @@ internal class JUnit5RobolectricSandboxBuilder @Inject constructor(
instrumentationConfig: InstrumentationConfiguration,
runtimeSdk: Sdk,
compileSdk: Sdk,
resourcesMode: ResourcesMode,
resourcesMode: ResourcesMode.Mode,
sqLiteMode: SQLiteMode.Mode,
): AndroidSandbox {
val testClass = testClassContainer.testClass
Expand All @@ -39,7 +37,6 @@ internal class JUnit5RobolectricSandboxBuilder @Inject constructor(
runtimeSdk,
compileSdk,
resourcesMode,
apkLoader,
testEnvironmentSpec,
sdkSandboxClassLoader,
shadowProviders,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package tech.apter.junit.jupiter.robolectric.internal

import org.robolectric.annotation.GraphicsMode
import org.robolectric.annotation.LooperMode
import org.robolectric.annotation.ResourcesMode
import org.robolectric.annotation.SQLiteMode
import org.robolectric.internal.AndroidSandbox
import org.robolectric.internal.ResourcesMode
import org.robolectric.internal.SandboxManager
import org.robolectric.internal.bytecode.InstrumentationConfiguration
import org.robolectric.pluginapi.Sdk
Expand All @@ -23,7 +23,7 @@ internal class JUnit5RobolectricSandboxManager @Inject constructor(
override fun getAndroidSandbox(
instrumentationConfig: InstrumentationConfiguration,
sdk: Sdk,
resourcesMode: ResourcesMode,
resourcesMode: ResourcesMode.Mode,
looperMode: LooperMode.Mode,
sqliteMode: SQLiteMode.Mode,
graphicsMode: GraphicsMode.Mode,
Expand All @@ -50,7 +50,7 @@ internal class JUnit5RobolectricSandboxManager @Inject constructor(
private val testClassName: String,
private val instrumentationConfiguration: InstrumentationConfiguration,
private val sdk: Sdk,
private val resourcesMode: ResourcesMode,
private val resourcesMode: ResourcesMode.Mode,
private val graphicsMode: GraphicsMode.Mode,
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package tech.apter.junit.jupiter.robolectric.internal

import org.robolectric.annotation.ResourcesMode
import org.robolectric.annotation.SQLiteMode
import org.robolectric.internal.AndroidSandbox
import org.robolectric.internal.ResourcesMode
import org.robolectric.internal.SandboxManager.SandboxBuilder
import org.robolectric.internal.bytecode.InstrumentationConfiguration
import org.robolectric.pluginapi.Sdk
Expand All @@ -24,7 +24,7 @@ class JUnit5RobolectricSandboxBuilderTest {
val instrumentationConfiguration = createInstrumentationConfiguration()
val runtimeSdk: Sdk = TestUtil.sdkCollection.getSdk(33)
val compileSdk: Sdk = TestUtil.sdkCollection.getSdk(33)
val resourcesMode: ResourcesMode = ResourcesMode.BINARY
val resourcesMode: ResourcesMode.Mode = ResourcesMode.Mode.BINARY
val sqLiteMode: SQLiteMode.Mode = SQLiteMode.Mode.NATIVE

subjectUnderTest {
Expand All @@ -50,7 +50,7 @@ class JUnit5RobolectricSandboxBuilderTest {
val instrumentationConfiguration2 = createInstrumentationConfiguration()
val runtimeSdk2: Sdk = TestUtil.sdkCollection.getSdk(32)
val compileSdk2: Sdk = TestUtil.sdkCollection.getSdk(32)
val resourcesMode: ResourcesMode = ResourcesMode.BINARY
val resourcesMode: ResourcesMode.Mode = ResourcesMode.Mode.BINARY
val sqLiteMode: SQLiteMode.Mode = SQLiteMode.Mode.NATIVE

subjectUnderTest {
Expand Down

0 comments on commit d660ddf

Please sign in to comment.