Skip to content

Commit 5bef289

Browse files
authored
Merge pull request #604 from PierreBtz/pbeitz/fix-test
2 parents e06afa9 + 5039db0 commit 5bef289

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/test/java/org/zendesk/client/v2/RealSmokeTest.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1795,15 +1795,23 @@ public void createOrganizationMemberships() throws Exception {
17951795

17961796
@Test
17971797
public void lookupOrganizationByExternalId() throws Exception {
1798+
String orgId = "i";
17981799
createClientWithTokenOrPassword();
17991800

18001801
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);
18041807

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+
}
18071815

18081816
assertThrows(
18091817
IllegalArgumentException.class, () -> instance.lookupOrganizationsByExternalId(""));

0 commit comments

Comments
 (0)