Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Trutz2011-05-06 12:33:28 +0000
committerChris Aniszczyk2011-05-06 14:01:56 +0000
commitae81bd433ef66f15ccc9993ba27aae37f537427c (patch)
tree63641a37ee35b3bfffd2847315fd8e0d4fd61522 /org.eclipse.mylyn.github.tests
parent84c7ade8ea08be53cc97e396f8ab326002916586 (diff)
downloadegit-github-ae81bd433ef66f15ccc9993ba27aae37f537427c.tar.gz
egit-github-ae81bd433ef66f15ccc9993ba27aae37f537427c.tar.xz
egit-github-ae81bd433ef66f15ccc9993ba27aae37f537427c.zip
Add CommentTest
Change-Id: I4162c7b5e9b81d3dad11ae5e6fc8cdef878a2ee7 Signed-off-by: Christian Trutz <christian.trutz@gmail.com> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
Diffstat (limited to 'org.eclipse.mylyn.github.tests')
-rw-r--r--org.eclipse.mylyn.github.tests/META-INF/MANIFEST.MF1
-rwxr-xr-xorg.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/CommentTest.java47
-rw-r--r--org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/tests/AllHeadlessTests.java8
3 files changed, 53 insertions, 3 deletions
diff --git a/org.eclipse.mylyn.github.tests/META-INF/MANIFEST.MF b/org.eclipse.mylyn.github.tests/META-INF/MANIFEST.MF
index 16d752dc..8d67c594 100644
--- a/org.eclipse.mylyn.github.tests/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.github.tests/META-INF/MANIFEST.MF
@@ -18,6 +18,7 @@ Bundle-Vendor: Eclipse EGit
Import-Package: com.google.gson;version="1.6.0",
com.google.gson.reflect;version="1.6.0",
org.apache.commons.httpclient;version="3.1.0",
+ org.apache.commons.logging;version="1.0.4",
org.mockito;version="1.8.4",
org.mockito.runners;version="1.8.4",
org.mockito.stubbing;version="1.8.4"
diff --git a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/CommentTest.java b/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/CommentTest.java
new file mode 100755
index 00000000..f22dc029
--- /dev/null
+++ b/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/CommentTest.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Christian Trutz
+ * 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:
+ * Christian Trutz - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.mylyn.github.internal;
+
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
+/**
+ * Unit tests for {@link Comment}
+ */
+@SuppressWarnings("restriction")
+@RunWith(MockitoJUnitRunner.class)
+public class CommentTest {
+
+ private static final Gson gson = new GsonBuilder().setDateFormat(
+ "yyyy-MM-dd").create();
+
+ @Test
+ public void getCreatedAt_ReferenceMutableObject() {
+ Comment comment = gson.fromJson("{createdAt : '2003-10-10'}",
+ Comment.class);
+ comment.getCreatedAt().setTime(0);
+ assertTrue(comment.getCreatedAt().getTime() != 0);
+ }
+
+ @Test
+ public void getUpdatedAt_ReferenceMutableObject() {
+ Comment comment = gson.fromJson("{updatedAt : '2003-10-10'}",
+ Comment.class);
+ comment.getUpdatedAt().setTime(0);
+ assertTrue(comment.getUpdatedAt().getTime() != 0);
+ }
+}
diff --git a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/tests/AllHeadlessTests.java b/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/tests/AllHeadlessTests.java
index cf4c4e93..4fadbb4c 100644
--- a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/tests/AllHeadlessTests.java
+++ b/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/tests/AllHeadlessTests.java
@@ -12,6 +12,7 @@
*******************************************************************************/
package org.eclipse.mylyn.github.tests;
+import org.eclipse.mylyn.github.internal.CommentTest;
import org.eclipse.mylyn.github.internal.GistServiceTest;
import org.eclipse.mylyn.github.internal.GitHubClientTest;
import org.eclipse.mylyn.github.internal.IssueServiceTest;
@@ -23,9 +24,10 @@ import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
-@SuiteClasses({ GitHubClientTest.class, IssueServiceTest.class,
- LabelServiceTest.class, MilestoneServiceTest.class,
- GistServiceTest.class, PullRequestServiceTest.class })
+@SuiteClasses({ CommentTest.class, GitHubClientTest.class,
+ IssueServiceTest.class, LabelServiceTest.class,
+ MilestoneServiceTest.class, GistServiceTest.class,
+ PullRequestServiceTest.class })
public class AllHeadlessTests {
}

Back to the top