@@ -663,8 +663,7 @@ public void it_should_create_refund() throws BitPayApiException, BitPayGenericEx
663663 Mockito .when (this .bitPayClient .post ("refunds/" , createRefundJsonRequest , true ))
664664 .thenReturn (
665665 this .getHttpResponseWithSpecificBody (getPreparedJsonDataFromFile ("createRefundResponse.json" )));
666- Mockito .when (this .guidGenerator .execute ()).thenReturn (EXAMPLE_UUID );
667- Mockito .when (this .accessTokens .getAccessToken (Facade .MERCHANT )).thenReturn (merchantToken );
666+ this .stubGuidAndAccessToken (Facade .MERCHANT , merchantToken );
668667 Client testedClass = this .getTestedClass ();
669668
670669 // when
@@ -1556,8 +1555,7 @@ public void it_should_test_updatePayoutRecipient() throws BitPayApiException, Bi
15561555 payoutRecipient .setLabel (label );
15571556 payoutRecipient .setToken (PAYOUT_ACCESS_TOKEN );
15581557
1559- Mockito .when (this .guidGenerator .execute ()).thenReturn (EXAMPLE_UUID );
1560- Mockito .when (this .accessTokens .getAccessToken (Facade .PAYOUT )).thenReturn (PAYOUT_ACCESS_TOKEN );
1558+ this .stubGuidAndAccessToken (Facade .PAYOUT , PAYOUT_ACCESS_TOKEN );
15611559 Mockito .when (this .bitPayClient .update (
15621560 "recipients/" + RECIPIENT_ID ,
15631561 getPreparedJsonDataFromFile ("updatePayoutRecipientRequest.json" )
@@ -2104,4 +2102,12 @@ private Client getTestedClass() {
21042102 this .guidGenerator
21052103 );
21062104 }
2105+
2106+ private void stubGuidAndAccessToken (
2107+ Facade facade ,
2108+ String accessToken
2109+ ) throws BitPayGenericException {
2110+ Mockito .when (this .guidGenerator .execute ()).thenReturn (EXAMPLE_UUID );
2111+ Mockito .when (this .accessTokens .getAccessToken (facade )).thenReturn (accessToken );
2112+ }
21072113}
0 commit comments