|
1 | 1 | package com.baeldung.fuel |
2 | 2 |
|
3 | | -import awaitObjectResult |
4 | | -import awaitStringResponse |
5 | 3 | import com.github.kittinunf.fuel.Fuel |
6 | 4 | import com.github.kittinunf.fuel.core.FuelManager |
7 | | -import com.github.kittinunf.fuel.core.Request |
8 | 5 | import com.github.kittinunf.fuel.core.interceptors.cUrlLoggingRequestInterceptor |
9 | 6 | import com.github.kittinunf.fuel.gson.responseObject |
10 | 7 | import com.github.kittinunf.fuel.httpGet |
11 | 8 | import com.github.kittinunf.fuel.rx.rx_object |
12 | 9 | import com.google.gson.Gson |
13 | | -import kotlinx.coroutines.experimental.runBlocking |
14 | 10 | import org.junit.jupiter.api.Assertions |
15 | 11 | import org.junit.jupiter.api.Test |
16 | 12 | import java.io.File |
@@ -226,32 +222,24 @@ internal class FuelHttpUnitTest { |
226 | 222 |
|
227 | 223 | } |
228 | 224 |
|
229 | | - @Test |
230 | | - fun whenMakeGETRequestUsingCoroutines_thenResponseStatusCode200() { |
231 | | - |
232 | | - runBlocking { |
233 | | - val (request, response, result) = Fuel.get("http://httpbin.org/get").awaitStringResponse() |
234 | | - |
235 | | - result.fold({ data -> |
236 | | - Assertions.assertEquals(200, response.statusCode) |
237 | | - |
238 | | - }, { error -> }) |
239 | | - } |
240 | | - |
241 | | - } |
242 | | - |
243 | | - @Test |
244 | | - fun whenMakeGETRequestUsingCoroutines_thenDeserializeResponse() { |
245 | | - |
246 | | - |
247 | | - runBlocking { |
248 | | - Fuel.get("https://jsonplaceholder.typicode.com/posts?id=1").awaitObjectResult(Post.Deserializer()) |
249 | | - .fold({ data -> |
250 | | - Assertions.assertEquals(1, data.get(0).userId) |
251 | | - }, { error -> }) |
252 | | - } |
253 | | - |
254 | | - } |
| 225 | +// @Test |
| 226 | +// fun whenMakeGETRequestUsingCoroutines_thenResponseStatusCode200() = runBlocking { |
| 227 | +// val (request, response, result) = Fuel.get("http://httpbin.org/get").awaitStringResponse() |
| 228 | +// |
| 229 | +// result.fold({ data -> |
| 230 | +// Assertions.assertEquals(200, response.statusCode) |
| 231 | +// |
| 232 | +// }, { error -> }) |
| 233 | +// } |
| 234 | +// |
| 235 | +// |
| 236 | +// @Test |
| 237 | +// fun whenMakeGETRequestUsingCoroutines_thenDeserializeResponse() = runBlocking { |
| 238 | +// Fuel.get("https://jsonplaceholder.typicode.com/posts?id=1").awaitObjectResult(Post.Deserializer()) |
| 239 | +// .fold({ data -> |
| 240 | +// Assertions.assertEquals(1, data.get(0).userId) |
| 241 | +// }, { error -> }) |
| 242 | +// } |
255 | 243 |
|
256 | 244 | @Test |
257 | 245 | fun whenMakeGETPostRequestUsingRoutingAPI_thenDeserializeResponse() { |
|
0 commit comments