@Test public void shouldThrowsBadRequestOnRegister() { try { String responseAsString = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" + "<errors>" + "<error>" + "<code>11004</code>" + "<message>Currency is required.</message>" + "</error>" + "</errors>"; HttpResponse response = new HttpResponse(400, responseAsString); when(httpClient.execute(any(HttpMethod.class), anyString(), anyMap(), any(HttpRequestBody.class))).thenReturn(response); checkoutsResource.register(checkoutRegistration); } catch (PagSeguroBadRequestException e) { ServerErrors errors = e.getErrors(); ServerError error = errors.getErrors().iterator().next(); assertEquals(new Integer(11004), error.getCode()); assertEquals("Currency is required.", error.getMessage()); } catch (Exception e) { } }
public RegisteredCheckout register(Builder<CheckoutRegistration> checkoutRegistrationBuilder) { return register(checkoutRegistrationBuilder.build()); }
CheckoutsResource { public RegisteredCheckout register(Builder<CheckoutRegistration> checkoutRegistrationBuilder) { return register(checkoutRegistrationBuilder.build()); } }
CheckoutsResource { public RegisteredCheckout register(Builder<CheckoutRegistration> checkoutRegistrationBuilder) { return register(checkoutRegistrationBuilder.build()); } CheckoutsResource(PagSeguro pagSeguroAPI, HttpClient httpClient); }
CheckoutsResource { public RegisteredCheckout register(Builder<CheckoutRegistration> checkoutRegistrationBuilder) { return register(checkoutRegistrationBuilder.build()); } CheckoutsResource(PagSeguro pagSeguroAPI, HttpClient httpClient); RegisteredCheckout register(Builder<CheckoutRegistration> checkoutRegistrationBuilder); RegisteredCheckout register(CheckoutRegistration checkoutRegistration); }
CheckoutsResource { public RegisteredCheckout register(Builder<CheckoutRegistration> checkoutRegistrationBuilder) { return register(checkoutRegistrationBuilder.build()); } CheckoutsResource(PagSeguro pagSeguroAPI, HttpClient httpClient); RegisteredCheckout register(Builder<CheckoutRegistration> checkoutRegistrationBuilder); RegisteredCheckout register(CheckoutRegistration checkoutRegistration);  }