Skip to content

Commit d71ea3c

Browse files
committed
Update deprecated create on OkHttpJweInterceptorTest
1 parent d823e2a commit d71ea3c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/test/java/com/mastercard/developer/interceptors/OkHttpJweInterceptorTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public void testIntercept_ShouldEncryptRequestPayloadAndUpdateContentLengthHeade
5050
.build();
5151
Request request = new Request.Builder()
5252
.url("https://sandbox.api.mastercard.com/service")
53-
.post(RequestBody.create(JSON_MEDIA_TYPE, "{\"foo\":\"bar\"}"))
53+
.post(RequestBody.create("{\"foo\":\"bar\"}", JSON_MEDIA_TYPE))
5454
.build();
5555
Chain chain = mock(Chain.class);
5656
Response response = mock(Response.class);
@@ -110,7 +110,7 @@ public void testIntercept_ShouldDecryptResponsePayloadAndUpdateContentLengthHead
110110
.build();
111111
Request request = mock(Request.class);
112112
Response encryptedResponse = new Response.Builder()
113-
.body(ResponseBody.create(JSON_MEDIA_TYPE, encryptedPayload))
113+
.body(ResponseBody.create(encryptedPayload, JSON_MEDIA_TYPE))
114114
.request(request)
115115
.code(200)
116116
.protocol(Protocol.HTTP_1_1)
@@ -143,7 +143,7 @@ public void testInterceptResponse_ShouldDecryptWithA128CBC_HS256Encryption() thr
143143
.build();
144144
Request request = mock(Request.class);
145145
Response encryptedResponse = new Response.Builder()
146-
.body(ResponseBody.create(JSON_MEDIA_TYPE, encryptedPayload))
146+
.body(ResponseBody.create(encryptedPayload, JSON_MEDIA_TYPE))
147147
.request(request)
148148
.code(200)
149149
.protocol(Protocol.HTTP_1_1)
@@ -195,7 +195,7 @@ public void testIntercept_ShouldDoNothing_WhenResponseWithEmptyPayload() throws
195195
Response response = mock(Response.class);
196196
when(chain.request()).thenReturn(request);
197197
when(chain.proceed(any(Request.class))).thenReturn(response);
198-
when(response.body()).thenReturn(ResponseBody.create(JSON_MEDIA_TYPE, ""));
198+
when(response.body()).thenReturn(ResponseBody.create("", JSON_MEDIA_TYPE));
199199

200200
// WHEN
201201
OkHttpJweInterceptor instanceUnderTest = new OkHttpJweInterceptor(config);
@@ -223,7 +223,7 @@ public void testIntercept_ShouldThrowIOException_WhenDecryptionFails() throws Ex
223223
when(request.body()).thenReturn(null);
224224
when(chain.request()).thenReturn(request);
225225
when(chain.proceed(any(Request.class))).thenReturn(response);
226-
when(response.body()).thenReturn(ResponseBody.create(JSON_MEDIA_TYPE, encryptedPayload));
226+
when(response.body()).thenReturn(ResponseBody.create(encryptedPayload, JSON_MEDIA_TYPE));
227227

228228
// THEN
229229
expectedException.expect(IOException.class);

0 commit comments

Comments
 (0)