diff options
| author | Christian Trutz | 2011-05-05 20:54:05 +0000 |
|---|---|---|
| committer | Christian Trutz | 2011-05-05 20:54:05 +0000 |
| commit | 039ce32da4ca76c9138ec879f52c9649507a6d4e (patch) | |
| tree | dc4d349b2c331f2bc76b8d10e01f2d5e5ee6ae78 | |
| parent | f6cf2b0b4621e01b5909280b1b42256a0710afef (diff) | |
| download | egit-github-039ce32da4ca76c9138ec879f52c9649507a6d4e.tar.gz egit-github-039ce32da4ca76c9138ec879f52c9649507a6d4e.tar.xz egit-github-039ce32da4ca76c9138ec879f52c9649507a6d4e.zip | |
PullRequestService unit tests completed.
Change-Id: I2668a1d4249b7e31af38647a51d9860576dbe928
Signed-off-by: Christian Trutz <christian.trutz@gmail.com>
2 files changed, 27 insertions, 2 deletions
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/PullRequestService.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/PullRequestService.java index 37622ada..496a21f6 100644 --- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/PullRequestService.java +++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/PullRequestService.java @@ -94,9 +94,11 @@ public class PullRequestService { throws IOException { Assert.isNotNull(repository, "Repository cannot be null"); //$NON-NLS-1$ Assert.isNotNull(state, "State cannot be null"); //$NON-NLS-1$ + String repositoryId = repository.getId(); + Assert.isNotNull(repositoryId, "Repository id cannot be null"); //$NON-NLS-1$ StringBuilder uri = new StringBuilder(IGitHubConstants.SEGMENT_V2_API); uri.append(IGitHubConstants.SEGMENT_PULLS); - uri.append('/').append(repository.getId()); + uri.append('/').append(repositoryId); uri.append('/').append(state); PullRequestsWrapper wrapper = this.client.get(uri.toString(), PullRequestsWrapper.class); diff --git a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/PullRequestServiceTest.java b/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/PullRequestServiceTest.java index 2b0b78c3..512c0804 100755 --- a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/PullRequestServiceTest.java +++ b/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/PullRequestServiceTest.java @@ -16,6 +16,7 @@ import java.io.IOException; import org.eclipse.core.runtime.AssertionFailedException;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -63,8 +64,30 @@ public class PullRequestServiceTest { }
@Test
+ @Ignore
public void getPullRequest_OK() throws IOException {
- // the OK unit test is not possible with Mockito, but with JMOckit
+ // the OK unit test is not possible with Mockito, but with JMockit
}
+ @Test(expected = AssertionFailedException.class)
+ public void getPullRequests_NullRepository() throws IOException {
+ pullRequestService.getPullRequests(null, "not null");
+ }
+
+ @Test(expected = AssertionFailedException.class)
+ public void getPullRequests_NullState() throws IOException {
+ pullRequestService.getPullRequests(repository, null);
+ }
+
+ @Test(expected = AssertionFailedException.class)
+ public void getPullRequests_NullRepositoryId() throws IOException {
+ when(repository.getId()).thenReturn(null);
+ pullRequestService.getPullRequests(repository, "test_state");
+ }
+
+ @Test
+ @Ignore
+ public void getPullRequests_OK() throws IOException {
+ // the OK unit test is not possible with Mockito, but with JMockit
+ }
}
|
