Skip to content

Commit 8624697

Browse files
Fix build.
1 parent 4541ef1 commit 8624697

File tree

3 files changed

+200
-173
lines changed

3 files changed

+200
-173
lines changed

payments-core/src/test/java/com/stripe/android/challenge/confirmation/IntentConfirmationWebViewClientTest.kt

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package com.stripe.android.challenge.confirmation
22

33
import android.net.Uri
44
import android.net.http.SslError
5-
import android.os.Build
65
import android.webkit.RenderProcessGoneDetail
76
import android.webkit.SslErrorHandler
87
import android.webkit.WebResourceError
@@ -17,14 +16,12 @@ import org.mockito.kotlin.mock
1716
import org.mockito.kotlin.verify
1817
import org.mockito.kotlin.whenever
1918
import org.robolectric.RobolectricTestRunner
20-
import org.robolectric.annotation.Config
2119

2220
@RunWith(RobolectricTestRunner::class)
2321
internal class IntentConfirmationWebViewClientTest {
2422

2523
// onReceivedError (API 23+) tests
2624
@Test
27-
@Config(sdk = [Build.VERSION_CODES.M])
2825
fun `onReceivedError for host url calls errorHandler with correct details`() =
2926
testWithSetup { client, errors, webView ->
3027
val request = createRequest(HOST_URL)
@@ -43,7 +40,6 @@ internal class IntentConfirmationWebViewClientTest {
4340
}
4441

4542
@Test
46-
@Config(sdk = [Build.VERSION_CODES.M])
4743
fun `onReceivedError for wrong url does not call errorHandler`() = testWithSetup { client, errors, webView ->
4844
val request = createRequest(url = "https://example.com/iframe")
4945
val error = createWebResourceError()
@@ -54,7 +50,6 @@ internal class IntentConfirmationWebViewClientTest {
5450
}
5551

5652
@Test
57-
@Config(sdk = [Build.VERSION_CODES.M])
5853
fun `onReceivedError handles trailing slash in failingUrl`() = testWithSetup { client, errors, webView ->
5954
val request = createRequest(url = "$HOST_URL/")
6055
val error = createWebResourceError()
@@ -71,7 +66,6 @@ internal class IntentConfirmationWebViewClientTest {
7166
}
7267

7368
@Test
74-
@Config(sdk = [Build.VERSION_CODES.M])
7569
fun `onReceivedError handles trailing slash in hostUrl`() =
7670
testWithSetup("$HOST_URL/") { client, errors, webView ->
7771
val request = createRequest(HOST_URL)
@@ -88,56 +82,8 @@ internal class IntentConfirmationWebViewClientTest {
8882
)
8983
}
9084

91-
// onReceivedError (Pre-API 23) tests
92-
@Test
93-
@Config(sdk = [Build.VERSION_CODES.LOLLIPOP])
94-
fun `onReceivedError legacy API calls errorHandler`() = testWithSetup { client, errors, webView ->
95-
@Suppress("DEPRECATION")
96-
client.onReceivedError(webView, -2, "Connection failed", HOST_URL)
97-
98-
assertThat(errors).hasSize(1)
99-
errors[0].assertHasDetails(
100-
message = "Connection failed",
101-
errorCode = -2,
102-
url = HOST_URL,
103-
type = "generic_resource_error"
104-
)
105-
}
106-
107-
@Test
108-
@Config(sdk = [Build.VERSION_CODES.LOLLIPOP])
109-
fun `onReceivedError legacy API handles trailing slash in failingUrl`() = testWithSetup { client, errors, webView ->
110-
@Suppress("DEPRECATION")
111-
client.onReceivedError(webView, -2, "Connection failed", "$HOST_URL/")
112-
113-
assertThat(errors).hasSize(1)
114-
errors[0].assertHasDetails(
115-
message = "Connection failed",
116-
errorCode = -2,
117-
url = "$HOST_URL/",
118-
type = "generic_resource_error"
119-
)
120-
}
121-
122-
@Test
123-
@Config(sdk = [Build.VERSION_CODES.LOLLIPOP])
124-
fun `onReceivedError legacy API handles trailing slash in hostUrl`() =
125-
testWithSetup(hostUrl = "$HOST_URL/") { client, errors, webView ->
126-
@Suppress("DEPRECATION")
127-
client.onReceivedError(webView, -2, "Connection failed", HOST_URL)
128-
129-
assertThat(errors).hasSize(1)
130-
errors[0].assertHasDetails(
131-
message = "Connection failed",
132-
errorCode = -2,
133-
url = HOST_URL,
134-
type = "generic_resource_error"
135-
)
136-
}
137-
13885
// onReceivedHttpError tests
13986
@Test
140-
@Config(sdk = [Build.VERSION_CODES.M])
14187
fun `onReceivedHttpError for host url calls errorHandler`() = testWithSetup { client, errors, webView ->
14288
val request = createRequest(HOST_URL)
14389
val response = createWebResourceResponse()
@@ -154,7 +100,6 @@ internal class IntentConfirmationWebViewClientTest {
154100
}
155101

156102
@Test
157-
@Config(sdk = [Build.VERSION_CODES.M])
158103
fun `onReceivedHttpError for non-host url does not call errorHandler`() = testWithSetup { client, errors, webView ->
159104
val request = createRequest(url = "https://example.com/iframe")
160105
val response = createWebResourceResponse()
@@ -165,7 +110,6 @@ internal class IntentConfirmationWebViewClientTest {
165110
}
166111

167112
@Test
168-
@Config(sdk = [Build.VERSION_CODES.M])
169113
fun `onReceivedHttpError handles trailing slash in request url`() = testWithSetup { client, errors, webView ->
170114
val request = createRequest(url = "$HOST_URL/")
171115
val response = createWebResourceResponse()
@@ -182,7 +126,6 @@ internal class IntentConfirmationWebViewClientTest {
182126
}
183127

184128
@Test
185-
@Config(sdk = [Build.VERSION_CODES.M])
186129
fun `onReceivedHttpError handles trailing slash in hostUrl`() =
187130
testWithSetup(hostUrl = "$HOST_URL/") { client, errors, webView ->
188131
val request = createRequest(HOST_URL)
@@ -219,7 +162,6 @@ internal class IntentConfirmationWebViewClientTest {
219162

220163
// onRenderProcessGone tests
221164
@Test
222-
@Config(sdk = [Build.VERSION_CODES.O])
223165
fun `onRenderProcessGone calls errorHandler with view URL`() = testWithSetup { client, errors, webView ->
224166
webView.loadUrl(HOST_URL)
225167
val detail = createRenderProcessGoneDetail()

payments-ui-core/src/test/java/com/stripe/android/ui/core/elements/autocomplete/PlacesClientProxyTest.kt

Lines changed: 66 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.stripe.android.ui.core.elements.autocomplete
22

3+
import com.google.android.gms.maps.model.LatLng
34
import com.google.android.gms.tasks.Task
45
import com.google.android.gms.tasks.Tasks
56
import com.google.android.libraries.places.api.model.AutocompletePrediction
@@ -21,6 +22,7 @@ import com.google.android.libraries.places.api.net.SearchByTextRequest
2122
import com.google.android.libraries.places.api.net.SearchByTextResponse
2223
import com.google.android.libraries.places.api.net.SearchNearbyRequest
2324
import com.google.android.libraries.places.api.net.SearchNearbyResponse
25+
import com.google.android.libraries.places.internal.zzmy
2426
import com.google.common.truth.Truth.assertThat
2527
import com.stripe.android.testing.CoroutineTestRule
2628
import com.stripe.android.testing.FakeErrorReporter
@@ -229,17 +231,75 @@ class PlacesClientProxyTest {
229231
throw AssertionError("Not expected")
230232
}
231233

234+
override fun zza(
235+
p0: FindAutocompletePredictionsRequest?,
236+
p1: zzmy?
237+
): Task<*>? {
238+
throw AssertionError("Not expected")
239+
}
240+
232241
override fun zzb(
233-
p0: FetchPlaceRequest,
234-
p1: Int
235-
): Task<*> {
242+
p0: FetchPhotoRequest?,
243+
p1: zzmy?
244+
): Task<*>? {
245+
throw AssertionError("Not expected")
246+
}
247+
248+
override fun zzc(
249+
p0: FetchResolvedPhotoUriRequest?,
250+
p1: zzmy?
251+
): Task<*>? {
236252
throw AssertionError("Not expected")
237253
}
238254

239255
override fun zzd(
240-
p0: FindAutocompletePredictionsRequest,
241-
p1: Int
242-
): Task<*> {
256+
p0: FetchPlaceRequest?,
257+
p1: zzmy?
258+
): Task<*>? {
259+
throw AssertionError("Not expected")
260+
}
261+
262+
override fun zze(p0: LatLng): Task<*> {
263+
throw AssertionError("Not expected")
264+
}
265+
266+
override fun zzf(
267+
p0: FindCurrentPlaceRequest?,
268+
p1: zzmy?
269+
): Task<*>? {
270+
throw AssertionError("Not expected")
271+
}
272+
273+
override fun zzh(
274+
p0: IsOpenRequest?,
275+
p1: zzmy?
276+
): Task<*>? {
277+
throw AssertionError("Not expected")
278+
}
279+
280+
override fun zzi(
281+
p0: SearchByTextRequest?,
282+
p1: zzmy?
283+
): Task<*>? {
284+
throw AssertionError("Not expected")
285+
}
286+
287+
override fun zzj(
288+
p0: SearchNearbyRequest?,
289+
p1: zzmy?
290+
): Task<*>? {
291+
throw AssertionError("Not expected")
292+
}
293+
294+
override fun zzk() {
295+
throw AssertionError("Not expected")
296+
}
297+
298+
override fun zzl() {
299+
throw AssertionError("Not expected")
300+
}
301+
302+
override fun zzm() {
243303
throw AssertionError("Not expected")
244304
}
245305
}

0 commit comments

Comments
 (0)