@@ -51,7 +51,7 @@ public void testIntercept_ShouldEncryptRequestPayloadAndUpdateContentLengthHeade
5151 .build ();
5252 Request request = new Request .Builder ()
5353 .url ("https://sandbox.api.mastercard.com/service" )
54- .post (RequestBody .create (JSON_MEDIA_TYPE , "{\" foo\" :\" bar\" }" ))
54+ .post (RequestBody .create ("{\" foo\" :\" bar\" }" , JSON_MEDIA_TYPE ))
5555 .build ();
5656 Chain chain = mock (Chain .class );
5757 Response response = mock (Response .class );
@@ -109,7 +109,7 @@ public void testIntercept_ShouldThrowIOException_WhenEncryptionFails() throws Ex
109109 .build ();
110110 Request request = new Request .Builder ()
111111 .url ("https://sandbox.api.mastercard.com/service" )
112- .post (RequestBody .create (JSON_MEDIA_TYPE , "{\" foo\" :\" bar\" }" ))
112+ .post (RequestBody .create ("{\" foo\" :\" bar\" }" , JSON_MEDIA_TYPE ))
113113 .build ();
114114 Chain chain = mock (Chain .class );
115115 Response response = mock (Response .class );
@@ -144,7 +144,7 @@ public void testIntercept_ShouldDecryptResponsePayloadAndUpdateContentLengthHead
144144 .build ();
145145 Request request = mock (Request .class );
146146 Response encryptedResponse = new Response .Builder ()
147- .body (ResponseBody .create (JSON_MEDIA_TYPE , encryptedPayload ))
147+ .body (ResponseBody .create (encryptedPayload , JSON_MEDIA_TYPE ))
148148 .request (request )
149149 .code (200 )
150150 .protocol (Protocol .HTTP_1_1 )
@@ -196,7 +196,7 @@ public void testIntercept_ShouldDoNothing_WhenResponseWithEmptyPayload() throws
196196 Response response = mock (Response .class );
197197 when (chain .request ()).thenReturn (request );
198198 when (chain .proceed (any (Request .class ))).thenReturn (response );
199- when (response .body ()).thenReturn (ResponseBody .create (JSON_MEDIA_TYPE , "" ));
199+ when (response .body ()).thenReturn (ResponseBody .create ("" , JSON_MEDIA_TYPE ));
200200
201201 // WHEN
202202 OkHttpFieldLevelEncryptionInterceptor instanceUnderTest = new OkHttpFieldLevelEncryptionInterceptor (config );
@@ -227,7 +227,7 @@ public void testIntercept_ShouldThrowIOException_WhenDecryptionFails() throws Ex
227227 when (request .body ()).thenReturn (null );
228228 when (chain .request ()).thenReturn (request );
229229 when (chain .proceed (any (Request .class ))).thenReturn (response );
230- when (response .body ()).thenReturn (ResponseBody .create (JSON_MEDIA_TYPE , encryptedPayload ));
230+ when (response .body ()).thenReturn (ResponseBody .create (encryptedPayload , JSON_MEDIA_TYPE ));
231231
232232 // THEN
233233 expectedException .expect (IOException .class );
@@ -253,7 +253,7 @@ public void testIntercept_ShouldEncryptRequestPayloadAndAddEncryptionHttpHeaders
253253 .build ();
254254 Request request = new Request .Builder ()
255255 .url ("https://sandbox.api.mastercard.com/service" )
256- .post (RequestBody .create (JSON_MEDIA_TYPE , "{\" foo\" :\" bar\" }" ))
256+ .post (RequestBody .create ("{\" foo\" :\" bar\" }" , JSON_MEDIA_TYPE ))
257257 .build ();
258258 Chain chain = mock (Chain .class );
259259 Response response = mock (Response .class );
@@ -302,7 +302,7 @@ public void testIntercept_ShouldDecryptResponsePayloadAndRemoveEncryptionHttpHea
302302
303303 Request request = mock (Request .class );
304304 Response encryptedResponse = new Response .Builder ()
305- .body (ResponseBody .create (JSON_MEDIA_TYPE , encryptedPayload ))
305+ .body (ResponseBody .create (encryptedPayload , JSON_MEDIA_TYPE ))
306306 .request (request )
307307 .header ("content-length" , "100" )
308308 .header ("x-iv" , "a32059c51607d0d02e823faecda5fb15" )
0 commit comments