mirror of
https://github.com/revanced/Apktool.git
synced 2024-11-11 06:59:24 +01:00
style: use new form of junit assertions
This commit is contained in:
parent
de03c8b689
commit
66b1c30fa0
@ -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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user