File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
main/java/org/kohsuke/github
test/java/org/kohsuke/github Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -667,7 +667,7 @@ public PagedIterable<GHOrganization> listOrganizations(final String since) {
667667 */
668668 public GHRepository getRepository (String name ) throws IOException {
669669 String [] tokens = name .split ("/" );
670- if (tokens .length < 2 ) {
670+ if (tokens .length != 2 ) {
671671 throw new IllegalArgumentException ("Repository name must be in format owner/repo" );
672672 }
673673 return GHRepository .read (this , tokens [0 ], tokens [1 ]);
Original file line number Diff line number Diff line change @@ -35,6 +35,14 @@ public void getRepository() throws IOException {
3535
3636 try {
3737 gitHub .getRepository ("hub4j_github-api" );
38+ fail ();
39+ } catch (IllegalArgumentException e ) {
40+ assertThat (e .getMessage (), equalTo ("Repository name must be in format owner/repo" ));
41+ }
42+
43+ try {
44+ gitHub .getRepository ("hub4j/github/api" );
45+ fail ();
3846 } catch (IllegalArgumentException e ) {
3947 assertThat (e .getMessage (), equalTo ("Repository name must be in format owner/repo" ));
4048 }
You can’t perform that action at this time.
0 commit comments