@Test public void testGetPreauthorization() { PreauthorizationService srv = Paymill.getService(PreauthorizationService.class); List<Preauthorization> list = srv.list(0, 1); Preauthorization tx = srv.get(list.get(0).getId()); assertNotNull(tx); assertNotNull(tx.getId()); }
@Test public void testGetNonExistingPreauthorization() { PreauthorizationService srv = Paymill.getService(PreauthorizationService.class); try { srv.get("idontexist"); fail("Expected exception"); } catch (ApiException ex) { assertEquals("not_found_transaction_preauthorize", ex.getCode()); } }