예제 #1
0
 public void testCreatePullRequestId_NonUrl() {
   try {
     PullRequestUrl.create("blah");
     fail("Expected exception");
   } catch (InvalidGithubUrl expected) {
     assertThat(expected.getMessage()).contains("url supplied is not a valid url: blah");
   }
 }
예제 #2
0
 public void testCreatePullRequestId_NonNumber() {
   String url = "http://github.com/blah/foo/pull/5a";
   try {
     PullRequestUrl.create(url);
     fail("Expected exception");
   } catch (InvalidGithubUrl expected) {
     assertThat(expected.getMessage()).contains("Invalid pull request number");
     assertThat(expected.getMessage()).contains(url);
   }
 }
예제 #3
0
 public void testCreatePullRequestId_NonGithubUrl() {
   String url = "http://gitblubbr.com/blah/foo/pull/5";
   try {
     PullRequestUrl.create(url);
     fail("Expected exception");
   } catch (InvalidGithubUrl expected) {
     assertThat(expected.getMessage()).contains("not a github.com url");
     assertThat(expected.getMessage()).contains(url);
   }
 }
예제 #4
0
 public void testCreatePullRequestId_NonPullRequestUrls() {
   try {
     PullRequestUrl.create("http://github.com/blah/foo/blargh/5");
     fail("Expected exception");
   } catch (InvalidGithubUrl expected) {
     assertThat(expected.getMessage()).contains("Invalid pull request URL: ");
   }
   try {
     PullRequestUrl.create("http://github.com/blah/foo/pulls");
     fail("Expected exception");
   } catch (InvalidGithubUrl expected) {
     assertThat(expected.getMessage()).contains("Invalid pull request URL: ");
   }
   try {
     PullRequestUrl.create("http://github.com/blah/foo/pull/5/foo");
     fail("Expected exception");
   } catch (InvalidGithubUrl expected) {
     assertThat(expected.getMessage()).contains("Invalid pull request URL: ");
   }
 }
예제 #5
0
 public void testCreatePullRequestId() {
   PullRequestUrl id = PullRequestUrl.create("http://github.com/foo/bar/pull/5");
   assertThat(id.owner()).isEqualTo("foo");
   assertThat(id.project()).isEqualTo("bar");
   assertThat(id.number()).isEqualTo(5);
   assertThat(id.apiAddress()).isEqualTo("https://api.github.com/repos/foo/bar/pulls/5");
 }