Refactor OkHttp examples

This commit is contained in:
Grzegorz Piwowarek 2016-11-11 15:02:37 +01:00
parent ec132346c7
commit 3daf23ae22
2 changed files with 6 additions and 12 deletions

View File

@ -60,9 +60,8 @@ public class OkHttpGetLiveTest {
Call call = client.newCall(request);
call.enqueue(new Callback() {
public void onResponse(Call call, Response response) throws IOException {
assertThat(response.code(), equalTo(200));
System.out.println("OK");
}
public void onFailure(Call call, IOException e) {

View File

@ -1,21 +1,16 @@
package org.baeldung.okhttp;
import okhttp3.*;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import okhttp3.Cache;
import okhttp3.Call;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
public class OkHttpMiscLiveTest {
private static final String BASE_URL = "http://localhost:8080/spring-rest";