Skip to content
Permalink
Browse files

Issue #41: Add test for IOException on HttpURLConnectionHttpClient

Closes #41: Add test for IOException on HttpURLConnectionHttpClient
  • Loading branch information...
fercarcedo committed Jun 22, 2018
1 parent d5ebdda commit 267c633217b920d2d76d134884e439c7b5efdcb6
@@ -12,9 +12,21 @@ import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
import java.net.URL

@RunWith(RobolectricTestRunner::class)
class HttpURLConnectionHttpClientTest {
@Test(expected = ExperimentDownloadException::class)
fun testGETIOException() {
val server = MockWebServer()
try {
val serverUrl = server.url("/").url().toString()
HttpURLConnectionHttpClient().get(URL(serverUrl.replace(server.port.toString(), (server.port + 1).toString())))
} finally {
server.shutdown()
}
}

@Test(expected = ExperimentDownloadException::class)
fun testGET404() {
testGETError(404)

0 comments on commit 267c633

Please sign in to comment.
You can’t perform that action at this time.