Appease checkstyle for test code.
Like PMD, we also had to add a concession to allow static imports. This time, it was achieved by moving the assertions to a more generally named `Assert` class, and then allowing static imports from that.
This commit is contained in:
parent
4e73d1e5e6
commit
53e74dcdbd
@ -1,4 +1,4 @@
|
|||||||
package org.fdroid.fdroid.data;
|
package org.fdroid.fdroid;
|
||||||
|
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
@ -6,6 +6,9 @@ import android.net.Uri;
|
|||||||
|
|
||||||
import junit.framework.AssertionFailedError;
|
import junit.framework.AssertionFailedError;
|
||||||
|
|
||||||
|
import org.fdroid.fdroid.data.ApkProvider;
|
||||||
|
import org.fdroid.fdroid.data.AppProvider;
|
||||||
|
import org.fdroid.fdroid.data.InstalledAppProvider;
|
||||||
import org.robolectric.shadows.ShadowContentResolver;
|
import org.robolectric.shadows.ShadowContentResolver;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -17,7 +20,7 @@ import static org.junit.Assert.assertNotNull;
|
|||||||
import static org.junit.Assert.assertNull;
|
import static org.junit.Assert.assertNull;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
public class ProviderTestUtils {
|
public class Assert {
|
||||||
|
|
||||||
public static <T extends Comparable> void assertContainsOnly(List<T> actualList, T[] expectedArray) {
|
public static <T extends Comparable> void assertContainsOnly(List<T> actualList, T[] expectedArray) {
|
||||||
List<T> expectedList = new ArrayList<>(expectedArray.length);
|
List<T> expectedList = new ArrayList<>(expectedArray.length);
|
@ -20,12 +20,12 @@ import java.io.File;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import static org.fdroid.fdroid.TestUtils.copyResourceToTempFile;
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
public abstract class MultiRepoUpdaterTest extends FDroidProviderTest {
|
public abstract class MultiRepoUpdaterTest extends FDroidProviderTest {
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private static final String TAG = "AcceptableMultiRepoUpdaterTest"; // NOPMD
|
private static final String TAG = "AcceptableMultiRepoUpdaterTest"; // NOPMD
|
||||||
|
|
||||||
protected static final String REPO_MAIN = "Test F-Droid repo";
|
protected static final String REPO_MAIN = "Test F-Droid repo";
|
||||||
@ -187,7 +187,7 @@ public abstract class MultiRepoUpdaterTest extends FDroidProviderTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean updateRepo(RepoUpdater updater, String indexJarPath) throws UpdateException {
|
private boolean updateRepo(RepoUpdater updater, String indexJarPath) throws UpdateException {
|
||||||
File indexJar = copyResourceToTempFile(indexJarPath);
|
File indexJar = TestUtils.copyResourceToTempFile(indexJarPath);
|
||||||
try {
|
try {
|
||||||
updater.processDownloadedFile(indexJar);
|
updater.processDownloadedFile(indexJar);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -8,4 +8,6 @@ import android.app.Application;
|
|||||||
* {@link Application} instead of {@link FDroidApp}. It intentionally doesn't extends {@link FDroidApp}
|
* {@link Application} instead of {@link FDroidApp}. It intentionally doesn't extends {@link FDroidApp}
|
||||||
* so that the static initialization in {@link FDroidApp#onCreate()} is not executed.
|
* so that the static initialization in {@link FDroidApp#onCreate()} is not executed.
|
||||||
*/
|
*/
|
||||||
public class TestFDroidApp extends Application {}
|
public class TestFDroidApp extends Application {
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -5,6 +5,7 @@ import android.content.ContentValues;
|
|||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
|
||||||
|
import org.fdroid.fdroid.Assert;
|
||||||
import org.fdroid.fdroid.BuildConfig;
|
import org.fdroid.fdroid.BuildConfig;
|
||||||
import org.fdroid.fdroid.Utils;
|
import org.fdroid.fdroid.Utils;
|
||||||
import org.fdroid.fdroid.mock.MockApk;
|
import org.fdroid.fdroid.mock.MockApk;
|
||||||
@ -20,9 +21,9 @@ import java.util.Collections;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.fdroid.fdroid.data.ProviderTestUtils.assertCantDelete;
|
import static org.fdroid.fdroid.Assert.assertCantDelete;
|
||||||
import static org.fdroid.fdroid.data.ProviderTestUtils.assertContainsOnly;
|
import static org.fdroid.fdroid.Assert.assertContainsOnly;
|
||||||
import static org.fdroid.fdroid.data.ProviderTestUtils.assertResultCount;
|
import static org.fdroid.fdroid.Assert.assertResultCount;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.junit.Assert.assertNull;
|
||||||
@ -37,8 +38,8 @@ public class ApkProviderTest extends FDroidProviderTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testAppApks() {
|
public void testAppApks() {
|
||||||
for (int i = 1; i <= 10; i++) {
|
for (int i = 1; i <= 10; i++) {
|
||||||
ProviderTestUtils.insertApk(contentResolver, "org.fdroid.fdroid", i);
|
Assert.insertApk(contentResolver, "org.fdroid.fdroid", i);
|
||||||
ProviderTestUtils.insertApk(contentResolver, "com.example", i);
|
Assert.insertApk(contentResolver, "com.example", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
assertTotalApkCount(20);
|
assertTotalApkCount(20);
|
||||||
@ -186,7 +187,7 @@ public class ApkProviderTest extends FDroidProviderTest {
|
|||||||
Apk apk = new MockApk("org.fdroid.fdroid", 13);
|
Apk apk = new MockApk("org.fdroid.fdroid", 13);
|
||||||
|
|
||||||
// Insert a new record...
|
// Insert a new record...
|
||||||
Uri newUri = ProviderTestUtils.insertApk(contentResolver, apk.packageName, apk.versionCode);
|
Uri newUri = Assert.insertApk(contentResolver, apk.packageName, apk.versionCode);
|
||||||
assertEquals(ApkProvider.getContentUri(apk).toString(), newUri.toString());
|
assertEquals(ApkProvider.getContentUri(apk).toString(), newUri.toString());
|
||||||
cursor = queryAllApks();
|
cursor = queryAllApks();
|
||||||
assertNotNull(cursor);
|
assertNotNull(cursor);
|
||||||
@ -204,7 +205,7 @@ public class ApkProviderTest extends FDroidProviderTest {
|
|||||||
|
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
public void testCursorMustMoveToFirst() {
|
public void testCursorMustMoveToFirst() {
|
||||||
ProviderTestUtils.insertApk(contentResolver, "org.example.test", 12);
|
Assert.insertApk(contentResolver, "org.example.test", 12);
|
||||||
Cursor cursor = queryAllApks();
|
Cursor cursor = queryAllApks();
|
||||||
new Apk(cursor);
|
new Apk(cursor);
|
||||||
}
|
}
|
||||||
@ -214,7 +215,7 @@ public class ApkProviderTest extends FDroidProviderTest {
|
|||||||
String[] projectionCount = new String[] {ApkProvider.DataColumns._COUNT};
|
String[] projectionCount = new String[] {ApkProvider.DataColumns._COUNT};
|
||||||
|
|
||||||
for (int i = 0; i < 13; i++) {
|
for (int i = 0; i < 13; i++) {
|
||||||
ProviderTestUtils.insertApk(contentResolver, "com.example", i);
|
Assert.insertApk(contentResolver, "com.example", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
Uri all = ApkProvider.getContentUri();
|
Uri all = ApkProvider.getContentUri();
|
||||||
@ -259,7 +260,7 @@ public class ApkProviderTest extends FDroidProviderTest {
|
|||||||
public void assertInvalidExtraField(String field) {
|
public void assertInvalidExtraField(String field) {
|
||||||
ContentValues invalidRepo = new ContentValues();
|
ContentValues invalidRepo = new ContentValues();
|
||||||
invalidRepo.put(field, "Test data");
|
invalidRepo.put(field, "Test data");
|
||||||
ProviderTestUtils.insertApk(contentResolver, "org.fdroid.fdroid", 10, invalidRepo);
|
Assert.insertApk(contentResolver, "org.fdroid.fdroid", 10, invalidRepo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -272,7 +273,7 @@ public class ApkProviderTest extends FDroidProviderTest {
|
|||||||
values.put(ApkProvider.DataColumns.REPO_ADDRESS, "http://example.com");
|
values.put(ApkProvider.DataColumns.REPO_ADDRESS, "http://example.com");
|
||||||
values.put(ApkProvider.DataColumns.REPO_VERSION, 3);
|
values.put(ApkProvider.DataColumns.REPO_VERSION, 3);
|
||||||
values.put(ApkProvider.DataColumns.FEATURES, "Some features");
|
values.put(ApkProvider.DataColumns.FEATURES, "Some features");
|
||||||
Uri uri = ProviderTestUtils.insertApk(contentResolver, "com.example.com", 1, values);
|
Uri uri = Assert.insertApk(contentResolver, "com.example.com", 1, values);
|
||||||
|
|
||||||
assertResultCount(1, queryAllApks());
|
assertResultCount(1, queryAllApks());
|
||||||
|
|
||||||
@ -298,18 +299,18 @@ public class ApkProviderTest extends FDroidProviderTest {
|
|||||||
public void testKnownApks() {
|
public void testKnownApks() {
|
||||||
|
|
||||||
for (int i = 0; i < 7; i++) {
|
for (int i = 0; i < 7; i++) {
|
||||||
ProviderTestUtils.insertApk(contentResolver, "org.fdroid.fdroid", i);
|
Assert.insertApk(contentResolver, "org.fdroid.fdroid", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 9; i++) {
|
for (int i = 0; i < 9; i++) {
|
||||||
ProviderTestUtils.insertApk(contentResolver, "org.example", i);
|
Assert.insertApk(contentResolver, "org.example", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
ProviderTestUtils.insertApk(contentResolver, "com.example", i);
|
Assert.insertApk(contentResolver, "com.example", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
ProviderTestUtils.insertApk(contentResolver, "com.apk.thingo", 1);
|
Assert.insertApk(contentResolver, "com.apk.thingo", 1);
|
||||||
|
|
||||||
Apk[] known = {
|
Apk[] known = {
|
||||||
new MockApk("org.fdroid.fdroid", 1),
|
new MockApk("org.fdroid.fdroid", 1),
|
||||||
@ -356,18 +357,18 @@ public class ApkProviderTest extends FDroidProviderTest {
|
|||||||
public void testFindByApp() {
|
public void testFindByApp() {
|
||||||
|
|
||||||
for (int i = 0; i < 7; i++) {
|
for (int i = 0; i < 7; i++) {
|
||||||
ProviderTestUtils.insertApk(contentResolver, "org.fdroid.fdroid", i);
|
Assert.insertApk(contentResolver, "org.fdroid.fdroid", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 9; i++) {
|
for (int i = 0; i < 9; i++) {
|
||||||
ProviderTestUtils.insertApk(contentResolver, "org.example", i);
|
Assert.insertApk(contentResolver, "org.example", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
ProviderTestUtils.insertApk(contentResolver, "com.example", i);
|
Assert.insertApk(contentResolver, "com.example", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
ProviderTestUtils.insertApk(contentResolver, "com.apk.thingo", 1);
|
Assert.insertApk(contentResolver, "com.apk.thingo", 1);
|
||||||
|
|
||||||
assertTotalApkCount(7 + 9 + 3 + 1);
|
assertTotalApkCount(7 + 9 + 3 + 1);
|
||||||
|
|
||||||
@ -391,7 +392,7 @@ public class ApkProviderTest extends FDroidProviderTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testUpdate() {
|
public void testUpdate() {
|
||||||
|
|
||||||
Uri apkUri = ProviderTestUtils.insertApk(contentResolver, "com.example", 10);
|
Uri apkUri = Assert.insertApk(contentResolver, "com.example", 10);
|
||||||
|
|
||||||
String[] allFields = ApkProvider.DataColumns.ALL;
|
String[] allFields = ApkProvider.DataColumns.ALL;
|
||||||
Cursor cursor = contentResolver.query(apkUri, allFields, null, null, null);
|
Cursor cursor = contentResolver.query(apkUri, allFields, null, null, null);
|
||||||
@ -447,18 +448,18 @@ public class ApkProviderTest extends FDroidProviderTest {
|
|||||||
// the Helper.find() method doesn't stumble upon the app we are interested
|
// the Helper.find() method doesn't stumble upon the app we are interested
|
||||||
// in by shear dumb luck...
|
// in by shear dumb luck...
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
ProviderTestUtils.insertApk(contentResolver, "org.fdroid.apk." + i, i);
|
Assert.insertApk(contentResolver, "org.fdroid.apk." + i, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
values.put(ApkProvider.DataColumns.VERSION_NAME, "v1.1");
|
values.put(ApkProvider.DataColumns.VERSION_NAME, "v1.1");
|
||||||
values.put(ApkProvider.DataColumns.HASH, "xxxxyyyy");
|
values.put(ApkProvider.DataColumns.HASH, "xxxxyyyy");
|
||||||
values.put(ApkProvider.DataColumns.HASH_TYPE, "a hash type");
|
values.put(ApkProvider.DataColumns.HASH_TYPE, "a hash type");
|
||||||
ProviderTestUtils.insertApk(contentResolver, "com.example", 11, values);
|
Assert.insertApk(contentResolver, "com.example", 11, values);
|
||||||
|
|
||||||
// ...and a few more for good measure...
|
// ...and a few more for good measure...
|
||||||
for (int i = 15; i < 20; i++) {
|
for (int i = 15; i < 20; i++) {
|
||||||
ProviderTestUtils.insertApk(contentResolver, "com.other.thing." + i, i);
|
Assert.insertApk(contentResolver, "com.other.thing." + i, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
Apk apk = ApkProvider.Helper.find(context, "com.example", 11);
|
Apk apk = ApkProvider.Helper.find(context, "com.example", 11);
|
||||||
@ -507,7 +508,7 @@ public class ApkProviderTest extends FDroidProviderTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
fail("Apk [" + apk + "] not found in " + ProviderTestUtils.listToString(apks));
|
fail("Apk [" + apk + "] not found in " + Assert.listToString(apks));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -534,7 +535,7 @@ public class ApkProviderTest extends FDroidProviderTest {
|
|||||||
protected Apk insertApkForRepo(String id, int versionCode, long repoId) {
|
protected Apk insertApkForRepo(String id, int versionCode, long repoId) {
|
||||||
ContentValues additionalValues = new ContentValues();
|
ContentValues additionalValues = new ContentValues();
|
||||||
additionalValues.put(ApkProvider.DataColumns.REPO_ID, repoId);
|
additionalValues.put(ApkProvider.DataColumns.REPO_ID, repoId);
|
||||||
Uri uri = ProviderTestUtils.insertApk(contentResolver, id, versionCode, additionalValues);
|
Uri uri = Assert.insertApk(contentResolver, id, versionCode, additionalValues);
|
||||||
return ApkProvider.Helper.get(context, uri);
|
return ApkProvider.Helper.get(context, uri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,8 @@ import org.robolectric.shadows.ShadowContentResolver;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.fdroid.fdroid.data.ProviderTestUtils.assertContainsOnly;
|
import static org.fdroid.fdroid.Assert.assertContainsOnly;
|
||||||
import static org.fdroid.fdroid.data.ProviderTestUtils.assertResultCount;
|
import static org.fdroid.fdroid.Assert.assertResultCount;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
@ -253,7 +253,7 @@ public class AppProviderTest extends FDroidProviderTest {
|
|||||||
String[] projection = new String[] {
|
String[] projection = new String[] {
|
||||||
AppProvider.DataColumns._ID,
|
AppProvider.DataColumns._ID,
|
||||||
AppProvider.DataColumns.NAME,
|
AppProvider.DataColumns.NAME,
|
||||||
AppProvider.DataColumns.PACKAGE_NAME
|
AppProvider.DataColumns.PACKAGE_NAME,
|
||||||
};
|
};
|
||||||
return contentResolver.query(AppProvider.getContentUri(), projection, null, null, null);
|
return contentResolver.query(AppProvider.getContentUri(), projection, null, null, null);
|
||||||
}
|
}
|
||||||
@ -366,8 +366,4 @@ public class AppProviderTest extends FDroidProviderTest {
|
|||||||
|
|
||||||
contentResolver.insert(uri, values);
|
contentResolver.insert(uri, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://github.com/robolectric/robolectric/wiki/2.4-to-3.0-Upgrade-Guide
|
|
||||||
|
@ -35,5 +35,4 @@ public abstract class FDroidProviderTest {
|
|||||||
FDroidProvider.clearDbHelperSingleton();
|
FDroidProvider.clearDbHelperSingleton();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,8 @@ import org.robolectric.RuntimeEnvironment;
|
|||||||
import org.robolectric.annotation.Config;
|
import org.robolectric.annotation.Config;
|
||||||
import org.robolectric.shadows.ShadowContentResolver;
|
import org.robolectric.shadows.ShadowContentResolver;
|
||||||
|
|
||||||
import static org.fdroid.fdroid.data.ProviderTestUtils.assertIsInstalledVersionInDb;
|
import static org.fdroid.fdroid.Assert.assertIsInstalledVersionInDb;
|
||||||
import static org.fdroid.fdroid.data.ProviderTestUtils.assertResultCount;
|
import static org.fdroid.fdroid.Assert.assertResultCount;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
@ -24,7 +24,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
@Config(constants = BuildConfig.class, application = Application.class)
|
@Config(constants = BuildConfig.class, application = Application.class)
|
||||||
@RunWith(RobolectricGradleTestRunner.class)
|
@RunWith(RobolectricGradleTestRunner.class)
|
||||||
public class InstalledAppProviderTest extends FDroidProviderTest{
|
public class InstalledAppProviderTest extends FDroidProviderTest {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setup() {
|
||||||
|
@ -15,8 +15,8 @@ import org.robolectric.shadows.ShadowContentResolver;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.fdroid.fdroid.data.ProviderTestUtils.assertInvalidUri;
|
import static org.fdroid.fdroid.Assert.assertInvalidUri;
|
||||||
import static org.fdroid.fdroid.data.ProviderTestUtils.assertValidUri;
|
import static org.fdroid.fdroid.Assert.assertValidUri;
|
||||||
|
|
||||||
@Config(constants = BuildConfig.class)
|
@Config(constants = BuildConfig.class)
|
||||||
@RunWith(RobolectricGradleTestRunner.class)
|
@RunWith(RobolectricGradleTestRunner.class)
|
||||||
@ -44,7 +44,7 @@ public class ProviderUriTests {
|
|||||||
@Test
|
@Test
|
||||||
public void validInstalledAppProviderUris() {
|
public void validInstalledAppProviderUris() {
|
||||||
ShadowContentResolver.registerProvider(InstalledAppProvider.getAuthority(), new InstalledAppProvider());
|
ShadowContentResolver.registerProvider(InstalledAppProvider.getAuthority(), new InstalledAppProvider());
|
||||||
String[] projection = new String[] { InstalledAppProvider.DataColumns._ID };
|
String[] projection = new String[] {InstalledAppProvider.DataColumns._ID};
|
||||||
assertValidUri(resolver, InstalledAppProvider.getContentUri(), projection);
|
assertValidUri(resolver, InstalledAppProvider.getContentUri(), projection);
|
||||||
assertValidUri(resolver, InstalledAppProvider.getAppUri("org.example.app"), projection);
|
assertValidUri(resolver, InstalledAppProvider.getAppUri("org.example.app"), projection);
|
||||||
assertValidUri(resolver, InstalledAppProvider.getSearchUri("blah"), projection);
|
assertValidUri(resolver, InstalledAppProvider.getSearchUri("blah"), projection);
|
||||||
@ -63,7 +63,7 @@ public class ProviderUriTests {
|
|||||||
@Test
|
@Test
|
||||||
public void validRepoProviderUris() {
|
public void validRepoProviderUris() {
|
||||||
ShadowContentResolver.registerProvider(RepoProvider.getAuthority(), new RepoProvider());
|
ShadowContentResolver.registerProvider(RepoProvider.getAuthority(), new RepoProvider());
|
||||||
String[] projection = new String[] { RepoProvider.DataColumns._ID };
|
String[] projection = new String[] {RepoProvider.DataColumns._ID};
|
||||||
assertValidUri(resolver, RepoProvider.getContentUri(), projection);
|
assertValidUri(resolver, RepoProvider.getContentUri(), projection);
|
||||||
assertValidUri(resolver, RepoProvider.getContentUri(10000L), projection);
|
assertValidUri(resolver, RepoProvider.getContentUri(10000L), projection);
|
||||||
assertValidUri(resolver, RepoProvider.allExceptSwapUri(), projection);
|
assertValidUri(resolver, RepoProvider.allExceptSwapUri(), projection);
|
||||||
@ -79,7 +79,7 @@ public class ProviderUriTests {
|
|||||||
@Test
|
@Test
|
||||||
public void validAppProviderUris() {
|
public void validAppProviderUris() {
|
||||||
ShadowContentResolver.registerProvider(AppProvider.getAuthority(), new AppProvider());
|
ShadowContentResolver.registerProvider(AppProvider.getAuthority(), new AppProvider());
|
||||||
String[] projection = new String[] { AppProvider.DataColumns._ID };
|
String[] projection = new String[] {AppProvider.DataColumns._ID};
|
||||||
assertValidUri(resolver, AppProvider.getContentUri(), "content://org.fdroid.fdroid.data.AppProvider", projection);
|
assertValidUri(resolver, AppProvider.getContentUri(), "content://org.fdroid.fdroid.data.AppProvider", projection);
|
||||||
assertValidUri(resolver, AppProvider.getSearchUri("'searching!'"), "content://org.fdroid.fdroid.data.AppProvider/search/'searching!'", projection);
|
assertValidUri(resolver, AppProvider.getSearchUri("'searching!'"), "content://org.fdroid.fdroid.data.AppProvider/search/'searching!'", projection);
|
||||||
assertValidUri(resolver, AppProvider.getSearchUri("/"), "content://org.fdroid.fdroid.data.AppProvider/search/%2F", projection);
|
assertValidUri(resolver, AppProvider.getSearchUri("/"), "content://org.fdroid.fdroid.data.AppProvider/search/%2F", projection);
|
||||||
@ -110,7 +110,7 @@ public class ProviderUriTests {
|
|||||||
@Test
|
@Test
|
||||||
public void validApkProviderUris() {
|
public void validApkProviderUris() {
|
||||||
ShadowContentResolver.registerProvider(ApkProvider.getAuthority(), new ApkProvider());
|
ShadowContentResolver.registerProvider(ApkProvider.getAuthority(), new ApkProvider());
|
||||||
String[] projection = new String[] { ApkProvider.DataColumns._ID };
|
String[] projection = new String[] {ApkProvider.DataColumns._ID};
|
||||||
|
|
||||||
List<Apk> apks = new ArrayList<>(10);
|
List<Apk> apks = new ArrayList<>(10);
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
|
@ -32,8 +32,8 @@
|
|||||||
|
|
||||||
<module name="AvoidStarImport" />
|
<module name="AvoidStarImport" />
|
||||||
<module name="AvoidStaticImport">
|
<module name="AvoidStaticImport">
|
||||||
<property name="excludes"
|
<property name="excludes"
|
||||||
value="org.assertj.core.api.Assertions.*, org.junit.Assert.*, org.junit.Assume.*, org.junit.internal.matchers.ThrowableMessageMatcher.*, org.hamcrest.CoreMatchers.*, org.hamcrest.Matchers.*, org.springframework.boot.configurationprocessor.ConfigurationMetadataMatchers.*, org.springframework.boot.configurationprocessor.TestCompiler.*, org.mockito.Mockito.*, org.mockito.BDDMockito.*, org.mockito.Matchers.*, org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*, org.springframework.test.web.servlet.result.MockMvcResultMatchers.*, org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.*, org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.*, org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo" />
|
value="org.fdroid.fdroid.Assert.*, org.assertj.core.api.Assertions.*, org.junit.Assert.*, org.junit.Assume.*, org.junit.internal.matchers.ThrowableMessageMatcher.*, org.hamcrest.CoreMatchers.*, org.hamcrest.Matchers.*, org.springframework.boot.configurationprocessor.ConfigurationMetadataMatchers.*, org.springframework.boot.configurationprocessor.TestCompiler.*, org.mockito.Mockito.*, org.mockito.BDDMockito.*, org.mockito.Matchers.*, org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*, org.springframework.test.web.servlet.result.MockMvcResultMatchers.*, org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.*, org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.*, org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo" />
|
||||||
</module>
|
</module>
|
||||||
<module name="RedundantImport" />
|
<module name="RedundantImport" />
|
||||||
<module name="UnusedImports" />
|
<module name="UnusedImports" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user