Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Sawicki2012-04-18 04:11:32 +0000
committerKevin Sawicki2012-04-18 04:11:32 +0000
commit6055c14acf8f5de6418404d6f6c3a53bd04dc920 (patch)
tree92dcd77a64bffa0964ecc65de32aebcbf22719ee /org.eclipse.egit.github.core.tests/src/org/eclipse
parent4c729e19506e4266184c2b9ef9ce84cda6d19424 (diff)
downloadegit-github-6055c14acf8f5de6418404d6f6c3a53bd04dc920.tar.gz
egit-github-6055c14acf8f5de6418404d6f6c3a53bd04dc920.tar.xz
egit-github-6055c14acf8f5de6418404d6f6c3a53bd04dc920.zip
Add RepositoryIssue model class that includes repository
This type of object is returned from IssueService for requests that don't require a repository id to be specified such as all the watched issues for the currently authenticated user. This new model class simply extends Issue and adds a single Repository field. Change-Id: I08829493fadd2493a6ff29d2e7dba6d8033de423
Diffstat (limited to 'org.eclipse.egit.github.core.tests/src/org/eclipse')
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/IssueServiceTest.java5
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/RepositoryIssueTest.java43
2 files changed, 46 insertions, 2 deletions
diff --git a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/IssueServiceTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/IssueServiceTest.java
index cabb2ba9..b249c226 100644
--- a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/IssueServiceTest.java
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/IssueServiceTest.java
@@ -26,6 +26,7 @@ import org.eclipse.egit.github.core.Comment;
import org.eclipse.egit.github.core.Issue;
import org.eclipse.egit.github.core.IssueEvent;
import org.eclipse.egit.github.core.RepositoryId;
+import org.eclipse.egit.github.core.RepositoryIssue;
import org.eclipse.egit.github.core.client.GitHubClient;
import org.eclipse.egit.github.core.client.GitHubRequest;
import org.eclipse.egit.github.core.client.GitHubResponse;
@@ -691,7 +692,7 @@ public class IssueServiceTest {
*/
@Test
public void pageIssues() throws IOException {
- PageIterator<Issue> iterator = issueService.pageIssues();
+ PageIterator<RepositoryIssue> iterator = issueService.pageIssues();
assertNotNull(iterator);
assertTrue(iterator.hasNext());
assertEquals(Utils.page("/issues"), iterator.getRequest().generateUri());
@@ -733,7 +734,7 @@ public class IssueServiceTest {
*/
@Test
public void getCurrentUserIssues() throws IOException {
- List<Issue> issues = issueService.getIssues();
+ List<RepositoryIssue> issues = issueService.getIssues();
assertNotNull(issues);
assertTrue(issues.isEmpty());
}
diff --git a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/RepositoryIssueTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/RepositoryIssueTest.java
new file mode 100644
index 00000000..1709de70
--- /dev/null
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/RepositoryIssueTest.java
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * Copyright (c) 2012 GitHub Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Kevin Sawicki (GitHub Inc.) - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.egit.github.core.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import org.eclipse.egit.github.core.Repository;
+import org.eclipse.egit.github.core.RepositoryIssue;
+import org.junit.Test;
+
+/**
+ * Unit tests of {@link RepositoryIssue}
+ */
+public class RepositoryIssueTest {
+
+ /**
+ * Test default state of issue
+ */
+ @Test
+ public void defaultState() {
+ RepositoryIssue issue = new RepositoryIssue();
+ assertNull(issue.getRepository());
+ }
+
+ /**
+ * Test updating issue fields
+ */
+ @Test
+ public void updateFields() {
+ RepositoryIssue issue = new RepositoryIssue();
+ Repository repo = new Repository();
+ assertEquals(repo, issue.setRepository(repo).getRepository());
+ }
+}

Back to the top