@Test(groups = "integration") public void testUnauthorizedException() throws Exception { final String subdomain = System.getProperty(KILLBILL_PAYMENT_RECURLY_SUBDOMAIN); RecurlyClient unauthorizedRecurlyClient = new RecurlyClient("invalid-api-key", subdomain); unauthorizedRecurlyClient.open(); try { unauthorizedRecurlyClient.getAccounts(); Assert.fail("getAccounts call should not succeed with invalid credentials."); } catch (RecurlyAPIException expected) { Assert.assertEquals(expected.getRecurlyError().getSymbol(), "unauthorized"); } }
@Test(groups = "integration") public void testUnauthorizedException() throws Exception { final String subdomain = System.getProperty(KILLBILL_PAYMENT_RECURLY_SUBDOMAIN); RecurlyClient unauthorizedRecurlyClient = new RecurlyClient("invalid-api-key", subdomain); unauthorizedRecurlyClient.open(); try { unauthorizedRecurlyClient.getAccounts(); Assert.fail("getAccounts call should not succeed with invalid credentials."); } catch (RecurlyAPIException expected) { Assert.assertEquals(expected.getRecurlyError().getSymbol(), "unauthorized"); } }
Assert.fail("Should not have been able to fetch shipping address we just deleted"); } catch (RecurlyAPIException ex) { final RecurlyAPIError err = ex.getRecurlyError(); Assert.assertEquals(err.getSymbol(), "not_found"); } catch (Exception ex) {
Assert.fail("Should not have been able to fetch shipping address we just deleted"); } catch (RecurlyAPIException ex) { final RecurlyAPIError err = ex.getRecurlyError(); Assert.assertEquals(err.getSymbol(), "not_found"); } catch (Exception ex) {
Assert.fail("Failed to delete the Adjustment"); } catch (final RecurlyAPIException e) { Assert.assertEquals(e.getRecurlyError().getHttpStatusCode(), 404);
Assert.fail("Failed to delete the Adjustment"); } catch (final RecurlyAPIException e) { Assert.assertEquals(e.getRecurlyError().getHttpStatusCode(), 404);