Skip to content

Commit f713de9

Browse files
Rollback to 4.0.0
1 parent 049ec0a commit f713de9

File tree

2 files changed

+43
-45
lines changed

2 files changed

+43
-45
lines changed

odp/src/androidTest/java/com/optimizely/ab/android/odp/ODPSegmentClientTest.kt

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -68,45 +68,45 @@ class ODPSegmentClientTest {
6868
verify(urlConnection).disconnect()
6969
}
7070

71-
// @Test
72-
// fun fetchQualifiedSegments_400() {
73-
// `when`(urlConnection.responseCode).thenReturn(400)
74-
//
75-
// segmentClient.fetchQualifiedSegments(apiKey, apiEndpoint, payload)
76-
//
77-
// verify(client).execute(captor.capture(), eq(0), eq(0))
78-
// val received = captor.value.execute()
79-
//
80-
// assertNull(received)
81-
// verify(logger).error("Unexpected response from ODP segment endpoint, status: 400")
82-
// verify(urlConnection).disconnect()
83-
// }
84-
85-
// @Test
86-
// fun fetchQualifiedSegments_500() {
87-
// `when`(urlConnection.responseCode).thenReturn(500)
88-
//
89-
// segmentClient.fetchQualifiedSegments(apiKey, apiEndpoint, payload)
90-
//
91-
// verify(client).execute(captor.capture(), eq(0), eq(0))
92-
// val received = captor.value.execute()
93-
//
94-
// assertNull(received)
95-
// verify(logger).error("Unexpected response from ODP segment endpoint, status: 500")
96-
// verify(urlConnection).disconnect()
97-
// }
98-
99-
// @Test
100-
// fun fetchQualifiedSegments_connectionFailed() {
101-
// `when`(urlConnection.responseCode).thenReturn(200)
102-
//
103-
// apiEndpoint = "invalid-url"
104-
// segmentClient.fetchQualifiedSegments(apiKey, apiEndpoint, payload)
105-
//
106-
// verify(client).execute(captor.capture(), eq(0), eq(0))
107-
// val received = captor.value.execute()
108-
//
109-
// assertNull(received)
110-
// verify(logger).error(contains("Error making ODP segment request"), any())
111-
// }
71+
@Test
72+
fun fetchQualifiedSegments_400() {
73+
`when`(urlConnection.responseCode).thenReturn(400)
74+
75+
segmentClient.fetchQualifiedSegments(apiKey, apiEndpoint, payload)
76+
77+
verify(client).execute(captor.capture(), eq(0), eq(0))
78+
val received = captor.value.execute()
79+
80+
assertNull(received)
81+
verify(logger).error("Unexpected response from ODP segment endpoint, status: 400")
82+
verify(urlConnection).disconnect()
83+
}
84+
85+
@Test
86+
fun fetchQualifiedSegments_500() {
87+
`when`(urlConnection.responseCode).thenReturn(500)
88+
89+
segmentClient.fetchQualifiedSegments(apiKey, apiEndpoint, payload)
90+
91+
verify(client).execute(captor.capture(), eq(0), eq(0))
92+
val received = captor.value.execute()
93+
94+
assertNull(received)
95+
verify(logger).error("Unexpected response from ODP segment endpoint, status: 500")
96+
verify(urlConnection).disconnect()
97+
}
98+
99+
@Test
100+
fun fetchQualifiedSegments_connectionFailed() {
101+
`when`(urlConnection.responseCode).thenReturn(200)
102+
103+
apiEndpoint = "invalid-url"
104+
segmentClient.fetchQualifiedSegments(apiKey, apiEndpoint, payload)
105+
106+
verify(client).execute(captor.capture(), eq(0), eq(0))
107+
val received = captor.value.execute()
108+
109+
assertNull(received)
110+
verify(logger).error(contains("Error making ODP segment request"), any())
111+
}
112112
}

odp/src/main/java/com/optimizely/ab/android/odp/ODPSegmentClient.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,11 @@ open class ODPSegmentClient(private val client: ClientForODPOnly, private val lo
6262
} else {
6363
var errMsg = "Unexpected response from ODP segment endpoint, status: $status"
6464
logger.error(errMsg)
65-
// return@Request null
66-
throw Exception(errMsg)
65+
return@Request null
6766
}
6867
} catch (e: Exception) {
6968
logger.error("Error making ODP segment request", e)
70-
// return@Request null
71-
throw e
69+
return@Request null
7270
} finally {
7371
if (urlConnection != null) {
7472
try {

0 commit comments

Comments
 (0)