@BeforeMethod(groups = {"integration", "enterprise"}) public void setUp() throws Exception { final String apiKey = System.getProperty(KILLBILL_PAYMENT_RECURLY_API_KEY); String subDomainTemp = System.getProperty(KILLBILL_PAYMENT_RECURLY_SUBDOMAIN); if (apiKey == null) { Assert.fail("You need to set your Recurly api key to run integration tests:" + " -Dkillbill.payment.recurly.apiKey=..."); } if (subDomainTemp == null) { subDomainTemp = "api"; } final String subDomain = subDomainTemp; recurlyClient = new RecurlyClient(apiKey, subDomain); recurlyClient.open(); }
@BeforeMethod(groups = {"integration", "enterprise"}) public void setUp() throws Exception { final String apiKey = System.getProperty(KILLBILL_PAYMENT_RECURLY_API_KEY); String subDomainTemp = System.getProperty(KILLBILL_PAYMENT_RECURLY_SUBDOMAIN); if (apiKey == null) { Assert.fail("You need to set your Recurly api key to run integration tests:" + " -Dkillbill.payment.recurly.apiKey=..."); } if (subDomainTemp == null) { subDomainTemp = "api"; } final String subDomain = subDomainTemp; recurlyClient = new RecurlyClient(apiKey, subDomain); recurlyClient.open(); }
@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"); } }