-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Issue #48 : Migrated to Java 11
- Loading branch information
Showing
6 changed files
with
317 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
jdk: | ||
- openjdk11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
130 changes: 130 additions & 0 deletions
130
src/test/java/io/visual_regression_tracker/sdk_java/MockHttpClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
package io.visual_regression_tracker.sdk_java; | ||
|
||
import javax.net.ssl.SSLContext; | ||
import javax.net.ssl.SSLParameters; | ||
import javax.net.ssl.SSLSession; | ||
import java.net.Authenticator; | ||
import java.net.CookieHandler; | ||
import java.net.ProxySelector; | ||
import java.net.URI; | ||
import java.net.http.HttpClient; | ||
import java.net.http.HttpHeaders; | ||
import java.net.http.HttpRequest; | ||
import java.net.http.HttpResponse; | ||
import java.time.Duration; | ||
import java.util.Optional; | ||
import java.util.concurrent.CompletableFuture; | ||
import java.util.concurrent.Executor; | ||
|
||
public class MockHttpClient extends HttpClient { | ||
|
||
private final String body; | ||
private int statusCode; | ||
|
||
public MockHttpClient(int statusCode, String body) { | ||
this.statusCode = statusCode; | ||
this.body = body; | ||
} | ||
|
||
@Override | ||
public Optional<CookieHandler> cookieHandler() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Optional<Duration> connectTimeout() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Redirect followRedirects() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Optional<ProxySelector> proxy() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public SSLContext sslContext() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public SSLParameters sslParameters() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Optional<Authenticator> authenticator() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Version version() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Optional<Executor> executor() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public <T> HttpResponse<T> send(HttpRequest request, HttpResponse.BodyHandler<T> responseBodyHandler) { | ||
HttpResponse httpResponse = new HttpResponse() { | ||
@Override | ||
public int statusCode() { | ||
return statusCode; | ||
} | ||
|
||
@Override | ||
public HttpRequest request() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Optional<HttpResponse> previousResponse() { | ||
return Optional.empty(); | ||
} | ||
|
||
@Override | ||
public HttpHeaders headers() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Object body() { | ||
return body; | ||
} | ||
|
||
@Override | ||
public Optional<SSLSession> sslSession() { | ||
return Optional.empty(); | ||
} | ||
|
||
@Override | ||
public URI uri() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Version version() { | ||
return null; | ||
} | ||
}; | ||
return httpResponse; | ||
} | ||
|
||
@Override | ||
public <T> CompletableFuture<HttpResponse<T>> sendAsync(HttpRequest request, HttpResponse.BodyHandler<T> responseBodyHandler) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public <T> CompletableFuture<HttpResponse<T>> | ||
sendAsync(HttpRequest x, HttpResponse.BodyHandler<T> y, HttpResponse.PushPromiseHandler<T> z) { | ||
return null; | ||
} | ||
} |
Oops, something went wrong.