chore: Fix builds from bumping dependencies

This commit is contained in:
oSumAtrIX
2023-11-03 01:21:23 +01:00
parent 8b89993505
commit 6555fcdffe
2 changed files with 18 additions and 8 deletions

View File

@@ -3,8 +3,9 @@ package app.revanced.library
import app.revanced.library.Options.setOptions
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.options.types.BooleanPatchOption.Companion.booleanPatchOption
import app.revanced.patcher.patch.options.types.StringPatchOption.Companion.stringPatchOption
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.booleanPatchOption
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatchOption
import org.junit.jupiter.api.MethodOrderer
import org.junit.jupiter.api.Order
import org.junit.jupiter.api.Test
@@ -35,9 +36,10 @@ internal object PatchOptionsTest {
private const val CHANGED_JSON =
"[{\"patchName\":\"PatchOptionsTestPatch\",\"options\":[{\"key\":\"key1\",\"value\":\"test\"},{\"key\":\"key2\",\"value\":false}]}]"
object PatchOptionsTestPatch : BytecodePatch(name = "PatchOptionsTestPatch") {
var option1 by stringPatchOption("key1", null, "title1", "description1")
var option2 by booleanPatchOption("key2", true, "title2", "description2")
@Patch("PatchOptionsTestPatch")
object PatchOptionsTestPatch : BytecodePatch() {
var option1 by stringPatchOption("key1", null, null, "title1", "description1")
var option2 by booleanPatchOption("key2", true, null, "title2", "description2")
override fun execute(context: BytecodeContext) {
// Do nothing

View File

@@ -3,6 +3,7 @@ package app.revanced.library
import app.revanced.patcher.PatchSet
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.Patch
import org.junit.jupiter.api.Test
import kotlin.test.assertEquals
@@ -42,9 +43,16 @@ internal object PatchUtilsTest {
expected: String?, patches: PatchSet, compatiblePackageName: String
) = assertEquals(expected, PatchUtils.getMostCommonCompatibleVersion(patches, compatiblePackageName))
private fun newPatch(packageName: String, vararg versions: String) = object : BytecodePatch(
compatiblePackages = setOf(CompatiblePackage(packageName, versions.toSet()))
) {
private fun newPatch(packageName: String, vararg versions: String) = object : BytecodePatch() {
init {
// Set the compatible packages field to the supplied package name and versions reflectively,
// because the setter is private but needed for testing.
val compatiblePackagesField = Patch::class.java.getDeclaredField("compatiblePackages")
compatiblePackagesField.isAccessible = true
compatiblePackagesField.set(this, setOf(CompatiblePackage(packageName, versions.toSet())))
}
override fun execute(context: BytecodeContext) {}
}
}