Skip to content

Commit a5e1f9e

Browse files
authored
Merge pull request #147 from microsoftgraph/feature/deprecation-removal-and-deps-upgrade
feature/deprecation removal and deps upgrade
2 parents f8a5614 + c34f8fc commit a5e1f9e

File tree

7 files changed

+11
-18
lines changed

7 files changed

+11
-18
lines changed

gradle/dependencies.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
dependencies {
22
// Use JUnit test framework
3-
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
4-
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
3+
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.1'
4+
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.1'
55
testImplementation 'org.mockito:mockito-inline:3.7.7'
66

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

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

1111
implementation 'com.google.code.gson:gson:2.8.6'
12-
api 'com.azure:azure-identity:1.2.2'
12+
api 'com.azure:azure-identity:1.2.3'
1313
}

src/main/java/com/microsoft/graph/httpcore/ChaosHttpHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public Response intercept(@Nonnull final Chain chain) throws IOException {
6565
.code(MSClientErrorCodeTooManyRequests)
6666
.message("Too Many Requests")
6767
.addHeader(RETRY_AFTER, retryAfterValue)
68-
.body(ResponseBody.create(MediaType.get("application/json"), responseBody))
68+
.body(ResponseBody.create(responseBody, MediaType.get("application/json")))
6969
.build();
7070
} else {
7171
return chain.proceed(request);

src/test/java/com/microsoft/graph/content/BatchRequestContentTest.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
package com.microsoft.graph.content;
22

33
import static org.junit.jupiter.api.Assertions.assertEquals;
4-
import static org.junit.jupiter.api.Assertions.assertFalse;
54
import static org.junit.jupiter.api.Assertions.assertNotNull;
65
import static org.junit.jupiter.api.Assertions.assertNull;
76
import static org.junit.jupiter.api.Assertions.assertThrows;
8-
import static org.junit.jupiter.api.Assertions.assertTrue;
97
import static org.mockito.ArgumentMatchers.any;
108
import static org.mockito.Mockito.mock;
119
import static org.mockito.Mockito.when;
@@ -14,11 +12,8 @@
1412
import java.net.URL;
1513
import java.util.Arrays;
1614
import java.util.ArrayList;
17-
import java.util.HashSet;
18-
import java.util.concurrent.ThreadLocalRandom;
1915

2016
import com.google.gson.JsonObject;
21-
import com.google.gson.JsonParser;
2217
import com.microsoft.graph.authentication.IAuthenticationProvider;
2318
import com.microsoft.graph.core.BaseClient;
2419
import com.microsoft.graph.core.IBaseClient;
@@ -33,8 +28,6 @@
3328
import com.microsoft.graph.serializer.ISerializer;
3429

3530
import org.junit.jupiter.api.Test;
36-
import org.mockito.invocation.InvocationOnMock;
37-
import org.mockito.stubbing.Answer;
3831

3932
import okhttp3.Call;
4033
import okhttp3.MediaType;
@@ -154,7 +147,7 @@ public void executeBatchTest() throws Throwable {
154147

155148
final CoreHttpProvider mHttpProvider = new CoreHttpProvider(new DefaultSerializer(mock(ILogger.class)),
156149
mock(ILogger.class), mHttpClient);
157-
final IBaseClient mClient = BaseClient.builder().authenticationProvider(mock(IAuthenticationProvider.class))
150+
final IBaseClient<?> mClient = BaseClient.builder().authenticationProvider(mock(IAuthenticationProvider.class))
158151
.httpProvider(mHttpProvider).buildClient();
159152
final Response mResponse = new Response.Builder()
160153
.request(new Request.Builder().url("https://graph.microsoft.com/v1.0/$batch").build()).code(200)

src/test/java/com/microsoft/graph/http/BaseRequestTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ public void setUp() throws Exception {
4242
.request(new Request.Builder().url("https://a.b.c").build())
4343
.protocol(Protocol.HTTP_1_1)
4444
.code(200).message("OK").body(
45-
ResponseBody.create(MediaType.parse("application/json"),
46-
"{ \"id\": \"zzz\" }"
45+
ResponseBody.create("{ \"id\": \"zzz\" }", MediaType.parse("application/json")
4746
))
4847
.addHeader("Content-Type", "application/json")
4948
.build();

src/test/java/com/microsoft/graph/http/BaseStreamRequestTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@
3535
*/
3636
public class BaseStreamRequestTests {
3737

38-
private BaseClient mBaseClient;
38+
private BaseClient<Request> mBaseClient;
3939

4040
@BeforeEach
41+
@SuppressWarnings("unchecked")
4142
public void setUp() throws Exception {
4243
mBaseClient = mock(BaseClient.class);
4344
}

src/test/java/com/microsoft/graph/httpcore/RedirectHandlerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public void testGetRedirectForHeadMethod() {
185185
@Test
186186
public void testGetRedirectForPostMethod() {
187187
RedirectHandler redirectHandler = new RedirectHandler();
188-
RequestBody body = RequestBody.create(MediaType.parse("application/json"),"");
188+
RequestBody body = RequestBody.create("", MediaType.parse("application/json"));
189189
Request httppost = new Request.Builder().url(testurl).post(body).build();
190190
Response response = new Response.Builder()
191191
.protocol(Protocol.HTTP_1_1)

src/test/java/com/microsoft/graph/httpcore/RetryHandlerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public void testRetryRequestForStatusCode() {
9999
@Test
100100
public void testRetryRequestWithTransferEncoding() {
101101
RetryHandler retryhandler = new RetryHandler();
102-
Request httppost = new Request.Builder().url(testmeurl).post(RequestBody.create(MediaType.parse("application/json"), "TEST")).build();
102+
Request httppost = new Request.Builder().url(testmeurl).post(RequestBody.create("TEST", MediaType.parse("application/json"))).build();
103103
Response response = new Response.Builder()
104104
.protocol(Protocol.HTTP_1_1)
105105
.code(HttpURLConnection.HTTP_GATEWAY_TIMEOUT)
@@ -113,7 +113,7 @@ public void testRetryRequestWithTransferEncoding() {
113113
@Test
114114
public void testRetryRequestWithExponentialBackOff() {
115115
RetryHandler retryhandler = new RetryHandler();
116-
Request httppost = new Request.Builder().url(testmeurl).post(RequestBody.create(MediaType.parse("application/json"), "TEST")).build();
116+
Request httppost = new Request.Builder().url(testmeurl).post(RequestBody.create("TEST", MediaType.parse("application/json"))).build();
117117
Response response = new Response.Builder()
118118
.protocol(Protocol.HTTP_1_1)
119119
.code(HttpURLConnection.HTTP_GATEWAY_TIMEOUT)

0 commit comments

Comments
 (0)