diff --git a/app/build.gradle b/app/build.gradle index 39cf374e..67533be5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -89,6 +89,10 @@ android { exclude 'META-INF/NOTICE.txt' } + testOptions { + unitTests.returnDefaultValues = true + } + defaultConfig { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/java/com/etesync/syncadapter/HttpClient.kt b/app/src/main/java/com/etesync/syncadapter/HttpClient.kt index a4f7128f..97506420 100644 --- a/app/src/main/java/com/etesync/syncadapter/HttpClient.kt +++ b/app/src/main/java/com/etesync/syncadapter/HttpClient.kt @@ -115,7 +115,7 @@ class HttpClient private constructor( } } - constructor(context: Context, host: String?, authToken: String): this(context) { + constructor(context: Context?, host: String?, authToken: String): this(context) { addAuthentication(host, authToken) } diff --git a/app/src/test/java/com/etesync/syncadapter/journalmanager/AuthenticatorTest.kt b/app/src/test/java/com/etesync/syncadapter/journalmanager/AuthenticatorTest.kt index 0535c2ca..b5c669fe 100644 --- a/app/src/test/java/com/etesync/syncadapter/journalmanager/AuthenticatorTest.kt +++ b/app/src/test/java/com/etesync/syncadapter/journalmanager/AuthenticatorTest.kt @@ -24,7 +24,7 @@ class AuthenticatorTest { @Before @Throws(IOException::class) fun setUp() { - httpClient = HttpClient.create(null) + httpClient = HttpClient.Builder().build().okHttpClient remote = HttpUrl.parse("http://localhost:8000") // FIXME: hardcode for now, should make configureable } diff --git a/app/src/test/java/com/etesync/syncadapter/journalmanager/ServiceTest.kt b/app/src/test/java/com/etesync/syncadapter/journalmanager/ServiceTest.kt index 49a35083..c426c57a 100644 --- a/app/src/test/java/com/etesync/syncadapter/journalmanager/ServiceTest.kt +++ b/app/src/test/java/com/etesync/syncadapter/journalmanager/ServiceTest.kt @@ -28,12 +28,12 @@ class ServiceTest { @Before @Throws(Exception::class) fun setUp() { - httpClient = HttpClient.create(null) + httpClient = HttpClient.Builder().build().okHttpClient remote = HttpUrl.parse("http://localhost:8000") // FIXME: hardcode for now, should make configureable val journalAuthenticator = JournalAuthenticator(httpClient!!, remote!!) authToken = journalAuthenticator.getAuthToken(Helpers.USER, Helpers.PASSWORD) - httpClient = HttpClient.create(null, App.log, null, authToken!!) + httpClient = HttpClient.Builder(null, null, authToken!!).build().okHttpClient /* Reset */ val request = Request.Builder()