@Before public void setup() throws Exception { module = new ZuoraModule(); module.setEndpoint("https://apisandbox.zuora.com/apps/services/a/32.0"); module.connect(System.getenv("zuoraUsername"), System.getenv("zuoraPassword")); for (ZObject z : module.find("select id from Account")) { module.delete(ZObjectType.Account, Arrays.asList(z.getId())); } }
/** Test for fetching zobjects when there is an object that matches the query */ @Test public void findOneResult() throws Exception { String id = module.create(ZObjectType.Account, Collections.singletonList(testAccount())).get(0).getId(); try { Iterator<ZObject> result = module .find("SELECT Id, Name, AccountNumber FROM Account WHERE AccountNumber = '7891'") .iterator(); assertTrue(result.hasNext()); ZObject next = result.next(); assertNotNull(next.getId()); assertEquals(testAccount().get("Name"), next.getAt("Name")); assertFalse(result.hasNext()); } finally { module.delete(ZObjectType.Account, Arrays.asList(id)); } }