File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
main/java/org/zendesk/client/v2
test/java/org/zendesk/client/v2 Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -1423,8 +1423,8 @@ public JobStatus deleteOrganizations(long... ids) {
1423
1423
}
1424
1424
1425
1425
public Iterable <Organization > lookupOrganizationsByExternalId (String externalId ) {
1426
- if (externalId == null || externalId .length () < 2 ) {
1427
- throw new IllegalArgumentException ("Name must be at least 2 characters long " );
1426
+ if (externalId == null || externalId .length () == 0 ) {
1427
+ throw new IllegalArgumentException ("External ID must not be null or length 0 " );
1428
1428
}
1429
1429
return new PagedIterable <>(
1430
1430
tmpl ("/organizations/search.json{?external_id}" ).set ("external_id" , externalId ),
Original file line number Diff line number Diff line change 97
97
import static org .junit .Assert .assertEquals ;
98
98
import static org .junit .Assert .assertNotEquals ;
99
99
import static org .junit .Assert .assertNotNull ;
100
+ import static org .junit .Assert .assertThrows ;
100
101
import static org .junit .Assert .assertTrue ;
101
102
import static org .junit .Assert .assertFalse ;
102
103
import static org .junit .Assume .assumeThat ;
@@ -1583,6 +1584,21 @@ public void createOrganizationMemberships() throws Exception {
1583
1584
}
1584
1585
}
1585
1586
1587
+ @ Test
1588
+ public void lookupOrganizationByExternalId () throws Exception {
1589
+ createClientWithTokenOrPassword ();
1590
+
1591
+ Organization newOrganization = newTestOrganization ();
1592
+ newOrganization .setExternalId ("i" );
1593
+ Organization resultOrganization = instance .createOrganization (newOrganization );
1594
+ assertNotNull (resultOrganization );
1595
+
1596
+ Iterable <Organization > or = instance .lookupOrganizationsByExternalId ("i" );
1597
+ assertEquals (1 , StreamSupport .stream (or .spliterator (), false ).count ());
1598
+
1599
+ assertThrows (IllegalArgumentException .class , () -> instance .lookupOrganizationsByExternalId ("" ));
1600
+ }
1601
+
1586
1602
@ Test
1587
1603
public void getGroups () throws Exception {
1588
1604
createClientWithTokenOrPassword ();
You can’t perform that action at this time.
0 commit comments