/** 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)); } }
/** Test for fetching zobjects when there is no object that matches the query */ @Test public void findNoResult() throws Exception { Iterator<ZObject> result = module.find("SELECT Id FROM Account").iterator(); assertFalse(result.hasNext()); }