Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
dependencies {
// Use JUnit test framework
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.1'
testImplementation 'org.mockito:mockito-inline:3.7.7'

api 'com.squareup.okhttp3:okhttp:4.9.1'

implementation 'com.google.guava:guava:30.1-jre'

implementation 'com.google.code.gson:gson:2.8.6'
api 'com.azure:azure-identity:1.2.2'
api 'com.azure:azure-identity:1.2.3'
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public Response intercept(@Nonnull final Chain chain) throws IOException {
.code(MSClientErrorCodeTooManyRequests)
.message("Too Many Requests")
.addHeader(RETRY_AFTER, retryAfterValue)
.body(ResponseBody.create(MediaType.get("application/json"), responseBody))
.body(ResponseBody.create(responseBody, MediaType.get("application/json")))
.build();
} else {
return chain.proceed(request);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package com.microsoft.graph.content;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
Expand All @@ -14,11 +12,8 @@
import java.net.URL;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.concurrent.ThreadLocalRandom;

import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.microsoft.graph.authentication.IAuthenticationProvider;
import com.microsoft.graph.core.BaseClient;
import com.microsoft.graph.core.IBaseClient;
Expand All @@ -33,8 +28,6 @@
import com.microsoft.graph.serializer.ISerializer;

import org.junit.jupiter.api.Test;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;

import okhttp3.Call;
import okhttp3.MediaType;
Expand Down Expand Up @@ -154,7 +147,7 @@ public void executeBatchTest() throws Throwable {

final CoreHttpProvider mHttpProvider = new CoreHttpProvider(new DefaultSerializer(mock(ILogger.class)),
mock(ILogger.class), mHttpClient);
final IBaseClient mClient = BaseClient.builder().authenticationProvider(mock(IAuthenticationProvider.class))
final IBaseClient<?> mClient = BaseClient.builder().authenticationProvider(mock(IAuthenticationProvider.class))
.httpProvider(mHttpProvider).buildClient();
final Response mResponse = new Response.Builder()
.request(new Request.Builder().url("https://graph.microsoft.com/v1.0/$batch").build()).code(200)
Expand Down
3 changes: 1 addition & 2 deletions src/test/java/com/microsoft/graph/http/BaseRequestTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ public void setUp() throws Exception {
.request(new Request.Builder().url("https://a.b.c").build())
.protocol(Protocol.HTTP_1_1)
.code(200).message("OK").body(
ResponseBody.create(MediaType.parse("application/json"),
"{ \"id\": \"zzz\" }"
ResponseBody.create("{ \"id\": \"zzz\" }", MediaType.parse("application/json")
))
.addHeader("Content-Type", "application/json")
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@
*/
public class BaseStreamRequestTests {

private BaseClient mBaseClient;
private BaseClient<Request> mBaseClient;

@BeforeEach
@SuppressWarnings("unchecked")
public void setUp() throws Exception {
mBaseClient = mock(BaseClient.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public void testGetRedirectForHeadMethod() {
@Test
public void testGetRedirectForPostMethod() {
RedirectHandler redirectHandler = new RedirectHandler();
RequestBody body = RequestBody.create(MediaType.parse("application/json"),"");
RequestBody body = RequestBody.create("", MediaType.parse("application/json"));
Request httppost = new Request.Builder().url(testurl).post(body).build();
Response response = new Response.Builder()
.protocol(Protocol.HTTP_1_1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public void testRetryRequestForStatusCode() {
@Test
public void testRetryRequestWithTransferEncoding() {
RetryHandler retryhandler = new RetryHandler();
Request httppost = new Request.Builder().url(testmeurl).post(RequestBody.create(MediaType.parse("application/json"), "TEST")).build();
Request httppost = new Request.Builder().url(testmeurl).post(RequestBody.create("TEST", MediaType.parse("application/json"))).build();
Response response = new Response.Builder()
.protocol(Protocol.HTTP_1_1)
.code(HttpURLConnection.HTTP_GATEWAY_TIMEOUT)
Expand All @@ -113,7 +113,7 @@ public void testRetryRequestWithTransferEncoding() {
@Test
public void testRetryRequestWithExponentialBackOff() {
RetryHandler retryhandler = new RetryHandler();
Request httppost = new Request.Builder().url(testmeurl).post(RequestBody.create(MediaType.parse("application/json"), "TEST")).build();
Request httppost = new Request.Builder().url(testmeurl).post(RequestBody.create("TEST", MediaType.parse("application/json"))).build();
Response response = new Response.Builder()
.protocol(Protocol.HTTP_1_1)
.code(HttpURLConnection.HTTP_GATEWAY_TIMEOUT)
Expand Down