use of com.recurly.v3.exception.TransactionException in project recurly-client-java by recurly.
the class BaseClientTest method testTransactionError.
@Test
public void testTransactionError() throws IOException {
final Call mCall = mock(Call.class);
Answer answer = (i) -> {
return mCall;
};
when(mCall.execute()).thenReturn(MockClient.buildResponse(422, "Unprocessable Entity", getErrorResponse("transaction")));
OkHttpClient mockOkHttpClient = MockClient.getMockOkHttpClient(answer);
final MockClient client = new MockClient("apiKey", mockOkHttpClient);
TransactionException t = assertThrows(TransactionException.class, () -> {
client.removeResource("code-aaron");
});
assertEquals("mbca9aaao6xr", t.getError().getTransactionError().getTransactionId());
}
Aggregations