Skip to content

Commit

Permalink
Fix Cronet extension build and test.
Browse files Browse the repository at this point in the history
Recently added Java 8 features in the cronet extension and the linked native libs
require to enable Java 8 desugaring in gradle. Moreover, junit.assertThrows is not
available in our version and its usage has been replaced by the manual check.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=172077967
  • Loading branch information
tonihei authored and ojw28 committed Oct 13, 2017
1 parent 7038c8f commit c9ed936
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions extensions/cronet/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ android {
sourceSets.main {
jniLibs.srcDirs = ['jniLibs']
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
Expand Down Expand Up @@ -163,7 +162,12 @@ private UrlResponseInfo createUrlResponseInfoWithUrl(String url, int statusCode)
public void testOpeningTwiceThrows() throws HttpDataSourceException {
mockResponseStartSuccess();
dataSourceUnderTest.open(testDataSpec);
assertThrows(IllegalStateException.class, () -> dataSourceUnderTest.open(testDataSpec));
try {
dataSourceUnderTest.open(testDataSpec);
fail("Expected IllegalStateException.");
} catch (IllegalStateException e) {
// Expected.
}
}

@Test
Expand Down

0 comments on commit c9ed936

Please sign in to comment.