@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"); } }
} catch (RecurlyAPIException ex) { final RecurlyAPIError err = ex.getRecurlyError(); Assert.assertEquals(err.getSymbol(), "not_found"); } catch (Exception ex) { Assert.fail("Fetching deleted shipping address should have failed with 404 and instead failed because: " + ex.getMessage());
} catch (RecurlyAPIException ex) { final RecurlyAPIError err = ex.getRecurlyError(); Assert.assertEquals(err.getSymbol(), "not_found"); } catch (Exception ex) { Assert.fail("Fetching deleted shipping address should have failed with 404 and instead failed because: " + ex.getMessage());