File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
src/test/java/org/zendesk/client/v2 Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -1795,15 +1795,23 @@ public void createOrganizationMemberships() throws Exception {
1795
1795
1796
1796
@ Test
1797
1797
public void lookupOrganizationByExternalId () throws Exception {
1798
+ String orgId = "i" ;
1798
1799
createClientWithTokenOrPassword ();
1799
1800
1800
1801
Organization newOrganization = newTestOrganization ();
1801
- newOrganization .setExternalId ("i" );
1802
- Organization resultOrganization = instance .createOrganization (newOrganization );
1803
- assertNotNull (resultOrganization );
1802
+ newOrganization .setExternalId (orgId );
1803
+ Organization resultOrganization = null ;
1804
+ try {
1805
+ resultOrganization = instance .createOrganization (newOrganization );
1806
+ assertNotNull (resultOrganization );
1804
1807
1805
- Iterable <Organization > or = instance .lookupOrganizationsByExternalId ("i" );
1806
- assertEquals (1 , StreamSupport .stream (or .spliterator (), false ).count ());
1808
+ Iterable <Organization > or = instance .lookupOrganizationsByExternalId (orgId );
1809
+ assertEquals (1 , StreamSupport .stream (or .spliterator (), false ).count ());
1810
+ } finally {
1811
+ if (resultOrganization != null ) {
1812
+ instance .deleteOrganization (resultOrganization );
1813
+ }
1814
+ }
1807
1815
1808
1816
assertThrows (
1809
1817
IllegalArgumentException .class , () -> instance .lookupOrganizationsByExternalId ("" ));
You can’t perform that action at this time.
0 commit comments