Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Trutz2011-04-15 20:46:46 +0000
committerChristian Trutz2011-04-15 20:46:46 +0000
commit74087e9a09cec9f91d2f50bc7031456a0225a37c (patch)
tree5dcdb823bb322c8e72f7a1385fde035b6e0b9a4c /org.eclipse.mylyn.github.tests
parente3d366782907da89f931224481251c7ffb6d9b33 (diff)
downloadegit-github-74087e9a09cec9f91d2f50bc7031456a0225a37c.tar.gz
egit-github-74087e9a09cec9f91d2f50bc7031456a0225a37c.tar.xz
egit-github-74087e9a09cec9f91d2f50bc7031456a0225a37c.zip
Unit tests for IssueService#editIssue
Change-Id: I080a8c4ad3cf70512bc0431e6e83a0dd04aa169a Signed-off-by: Christian Trutz <christian.trutz@gmail.com>
Diffstat (limited to 'org.eclipse.mylyn.github.tests')
-rw-r--r--org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/IssueServiceTest.java37
1 files changed, 36 insertions, 1 deletions
diff --git a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/IssueServiceTest.java b/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/IssueServiceTest.java
index 3d765ee2..a6103216 100644
--- a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/IssueServiceTest.java
+++ b/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/IssueServiceTest.java
@@ -13,7 +13,9 @@ package org.eclipse.mylyn.github.internal;
import static org.mockito.Mockito.verify;
import java.io.IOException;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.eclipse.core.runtime.AssertionFailedException;
import org.junit.Before;
@@ -128,7 +130,40 @@ public class IssueServiceTest {
public void createIssue_NullIssue() throws IOException {
issueService.createIssue("test_user", "test_repository", null);
verify(gitHubClient).post(
- "/repos/test_user/test_repository/issues.json", null,
+ "/repos/test_user/test_repository/issues.json",
+ new HashMap<String, String>(), Issue.class);
+ }
+
+ @Test(expected = AssertionFailedException.class)
+ public void editIssue_NullUser() throws IOException {
+ issueService.editIssue(null, "not null", null);
+ }
+
+ @Test(expected = AssertionFailedException.class)
+ public void editIssue_NullRepository() throws IOException {
+ issueService.editIssue("not null", null, null);
+ }
+
+ @Test(expected = AssertionFailedException.class)
+ public void editIssue_NullIssue() throws IOException {
+ issueService.editIssue("not null", "not null", null);
+ }
+
+ @Test
+ public void editIssue_OK() throws IOException {
+ Issue issue = new Issue();
+ issue.setNumber(1);
+ issue.setTitle("test_title");
+ issue.setBody("test_body");
+ issue.setState("test_state");
+ issueService.editIssue("test_user", "test_repository", issue);
+
+ Map<String, String> params = new HashMap<String, String>();
+ params.put(IssueService.FIELD_TITLE, "test_title");
+ params.put(IssueService.FIELD_BODY, "test_body");
+ params.put(IssueService.FILTER_STATE, "test_state");
+ verify(gitHubClient).put(
+ "/repos/test_user/test_repository/issues/1.json", params,
Issue.class);
}
}

Back to the top