mirror of
https://github.com/revanced/Apktool.git
synced 2025-06-12 05:07:41 +02:00
Merge branch 'master' into gradle7
# Conflicts: # build.gradle
This commit is contained in:
@ -28,14 +28,12 @@ processResources {
|
||||
include '**/*.jar'
|
||||
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
||||
}
|
||||
|
||||
|
||||
includeEmptyDirs = false
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testImplementation("junit:junit:4.10") {
|
||||
exclude(module: 'hamcrest-core')
|
||||
}
|
||||
testImplementation depends.junit
|
||||
|
||||
api project(':brut.j.dir'),
|
||||
project(':brut.j.util'),
|
||||
@ -50,4 +48,4 @@ dependencies {
|
||||
depends.commons_io
|
||||
|
||||
testImplementation depends.xmlunit
|
||||
}
|
||||
}
|
||||
|
@ -27,5 +27,10 @@ public class CantFindFrameworkResException extends AndrolibException {
|
||||
return mPkgId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return String.format("Can't find framework resources for package of id: %d", this.getPkgId());
|
||||
}
|
||||
|
||||
private final int mPkgId;
|
||||
}
|
||||
|
Binary file not shown.
@ -31,9 +31,8 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class BaseTest {
|
||||
|
||||
@ -45,16 +44,16 @@ public class BaseTest {
|
||||
|
||||
Map<String, String> controlFiles = control.unknownFiles;
|
||||
Map<String, String> testFiles = test.unknownFiles;
|
||||
assertTrue(controlFiles.size() == testFiles.size());
|
||||
assertEquals(controlFiles.size(), testFiles.size());
|
||||
|
||||
// Make sure that the compression methods are still the same
|
||||
for (Map.Entry<String, String> controlEntry : controlFiles.entrySet()) {
|
||||
assertTrue(controlEntry.getValue().equals(testFiles.get(controlEntry.getKey())));
|
||||
assertEquals(controlEntry.getValue(), testFiles.get(controlEntry.getKey()));
|
||||
}
|
||||
}
|
||||
|
||||
protected void compareBinaryFolder(String path, boolean res) throws BrutException, IOException {
|
||||
Boolean exists = true;
|
||||
boolean exists = true;
|
||||
|
||||
String prefixPath = "";
|
||||
if (res) {
|
||||
|
@ -495,7 +495,7 @@ public class BuildAndDecodeTest extends BaseTest {
|
||||
MetaInfo metaInfo = new Androlib().readMetaFile(sTestNewDir);
|
||||
|
||||
for (String item : metaInfo.doNotCompress) {
|
||||
assertFalse(item.equals("jpg"));
|
||||
assertNotEquals("jpg", item);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,7 @@ import org.junit.Test;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class Empty9PatchTest extends BaseTest {
|
||||
@ -58,6 +59,6 @@ public class Empty9PatchTest extends BaseTest {
|
||||
|
||||
File aPng = new File(sTestOrigDir,"res/drawable-xhdpi/empty.9.png");
|
||||
assertTrue(aPng.isFile());
|
||||
assertTrue(aPng.length() == 0);
|
||||
assertEquals(0, aPng.length());
|
||||
}
|
||||
}
|
@ -30,12 +30,11 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class ForceManifestDecodeNoResourcesTest extends BaseTest {
|
||||
|
||||
private byte[] xmlHeader = new byte[] {
|
||||
private final byte[] xmlHeader = new byte[] {
|
||||
0x3C, // <
|
||||
0x3F, // ?
|
||||
0x78, // x
|
||||
@ -68,7 +67,7 @@ public class ForceManifestDecodeNoResourcesTest extends BaseTest {
|
||||
// lets probe filetype of manifest, we should detect XML
|
||||
File manifestFile = new File(output + File.separator + "AndroidManifest.xml");
|
||||
byte[] magic = TestUtils.readHeaderOfFile(manifestFile, 6);
|
||||
assertTrue(Arrays.equals(this.xmlHeader, magic));
|
||||
assertArrayEquals(this.xmlHeader, magic);
|
||||
|
||||
// confirm resources.arsc still exists, as its raw
|
||||
File resourcesArsc = new File(output + File.separator + "resources.arsc");
|
||||
@ -87,7 +86,7 @@ public class ForceManifestDecodeNoResourcesTest extends BaseTest {
|
||||
// lets probe filetype of manifest, we should detect XML
|
||||
File manifestFile = new File(output + File.separator + "AndroidManifest.xml");
|
||||
byte[] magic = TestUtils.readHeaderOfFile(manifestFile, 6);
|
||||
assertTrue(Arrays.equals(this.xmlHeader, magic));
|
||||
assertArrayEquals(this.xmlHeader, magic);
|
||||
|
||||
// confirm resources.arsc does not exist
|
||||
File resourcesArsc = new File(output + File.separator + "resources.arsc");
|
||||
@ -106,7 +105,7 @@ public class ForceManifestDecodeNoResourcesTest extends BaseTest {
|
||||
// lets probe filetype of manifest, we should detect XML
|
||||
File manifestFile = new File(output + File.separator + "AndroidManifest.xml");
|
||||
byte[] magic = TestUtils.readHeaderOfFile(manifestFile, 6);
|
||||
assertTrue(Arrays.equals(this.xmlHeader, magic));
|
||||
assertArrayEquals(this.xmlHeader, magic);
|
||||
|
||||
// confirm resources.arsc does not exist
|
||||
File resourcesArsc = new File(output + File.separator + "resources.arsc");
|
||||
|
@ -21,8 +21,8 @@ import brut.androlib.ApkDecoder;
|
||||
import brut.androlib.BaseTest;
|
||||
import brut.androlib.TestUtils;
|
||||
import brut.androlib.meta.MetaInfo;
|
||||
import brut.directory.ExtFile;
|
||||
import brut.common.BrutException;
|
||||
import brut.directory.ExtFile;
|
||||
import brut.util.OS;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
@ -31,7 +31,7 @@ import org.junit.Test;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
public class MissingVersionManifestTest extends BaseTest {
|
||||
|
||||
@ -58,6 +58,6 @@ public class MissingVersionManifestTest extends BaseTest {
|
||||
apkDecoder.decode();
|
||||
|
||||
MetaInfo metaInfo = new Androlib().readMetaFile(decodedApk);
|
||||
assertEquals(null, metaInfo.versionInfo.versionName);
|
||||
assertNull(metaInfo.versionInfo.versionName);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user