1) renamed test build type to 'debugTest' because updated gradle

plugin doesn't allow build types to start with 'test'.

2) exclude support-annotations to avoid warning

Closes #3273
// FREEBIE
This commit is contained in:
Rhodey Orbits 2015-06-01 21:44:10 -07:00 committed by Moxie Marlinspike
parent 200fc0c599
commit 5fe7c687f3
3 changed files with 16 additions and 19 deletions

View file

@ -77,6 +77,10 @@ dependencies {
}
androidTestCompile ('com.squareup.assertj:assertj-android:1.0.0') {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
exclude group: 'com.android.support', module: 'support-annotations'
}
androidTestCompile ('com.android.support.test:runner:0.2') {
exclude group: 'com.android.support', module: 'support-annotations'
}
androidTestCompile ('com.android.support.test.espresso:espresso-core:2.1') {
exclude group: 'javax.inject'
@ -131,7 +135,7 @@ dependencyVerification {
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
testBuildType "testing"
testBuildType "debugTest"
dexOptions {
javaMaxHeapSize "4g"
@ -186,8 +190,8 @@ android {
proguardFiles = buildTypes.debug.proguardFiles
signingConfig signingConfigs.release
}
testing.initWith(buildTypes.debug)
testing {
debugTest.initWith(buildTypes.debug)
debugTest {
proguardFile 'proguard-testing.pro'
buildConfigField "String", "PUSH_URL", "\"https://textsecure-service-staging.whispersystems.org\""
}

View file

@ -640,15 +640,5 @@ public class PartDatabase extends Database {
public boolean isValid() {
return rowId >= 0 && uniqueId >= 0;
}
@Override
public boolean equals(Object object) {
if (!(object instanceof PartId)){
return false;
}
PartId other = (PartId) object;
return rowId == other.rowId && uniqueId == other.uniqueId;
}
}
}

View file

@ -34,21 +34,24 @@ public class PartDatabaseTest extends TextSecureTestCase {
}
public void testTaskNotRunWhenThumbnailExists() throws Exception {
when(database.getPart(new PartId(ROW_ID, UNIQUE_ID))).thenReturn(getPduPartSkeleton("x/x"));
doReturn(mock(InputStream.class)).when(database).getDataStream(any(MasterSecret.class), any(PartId.class), eq("thumbnail"));
final PartId partId = new PartId(ROW_ID, UNIQUE_ID);
database.getThumbnailStream(null, new PartId(ROW_ID, UNIQUE_ID));
when(database.getPart(partId)).thenReturn(getPduPartSkeleton("x/x"));
doReturn(mock(InputStream.class)).when(database).getDataStream(any(MasterSecret.class), any(PartId.class), eq("thumbnail"));
database.getThumbnailStream(null, partId);
verify(database, never()).updatePartThumbnail(any(MasterSecret.class), any(PartId.class), any(PduPart.class), any(InputStream.class), anyFloat());
}
public void testTaskRunWhenThumbnailMissing() throws Exception {
when(database.getPart(new PartId(ROW_ID, UNIQUE_ID))).thenReturn(getPduPartSkeleton("image/png"));
final PartId partId = new PartId(ROW_ID, UNIQUE_ID);
when(database.getPart(partId)).thenReturn(getPduPartSkeleton("image/png"));
doReturn(null).when(database).getDataStream(any(MasterSecret.class), any(PartId.class), eq("thumbnail"));
doNothing().when(database).updatePartThumbnail(any(MasterSecret.class), any(PartId.class), any(PduPart.class), any(InputStream.class), anyFloat());
try {
database.new ThumbnailFetchCallable(mock(MasterSecret.class), new PartId(ROW_ID, UNIQUE_ID)).call();
database.new ThumbnailFetchCallable(mock(MasterSecret.class), partId).call();
throw new AssertionError("didn't try to generate thumbnail");
} catch (FileNotFoundException fnfe) {
// success