Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Sawicki2012-09-22 13:37:52 -0400
committerKevin Sawicki2012-09-22 13:37:52 -0400
commit61cd35f76bdeeb82e771ff53931bcaf07f44a942 (patch)
treec083915f10bebf5086a964d5acce28db2bbc606a
parent6e8dd15c95ba0c3d7fdea8fad177dc7389609357 (diff)
downloadegit-github-61cd35f76bdeeb82e771ff53931bcaf07f44a942.tar.gz
egit-github-61cd35f76bdeeb82e771ff53931bcaf07f44a942.tar.xz
egit-github-61cd35f76bdeeb82e771ff53931bcaf07f44a942.zip
Add unit tests of CommitStatus model
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/AllHeadlessTests.java1
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/CommitStatusTest.java62
2 files changed, 63 insertions, 0 deletions
diff --git a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/AllHeadlessTests.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/AllHeadlessTests.java
index 927d2841..9808ae6c 100644
--- a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/AllHeadlessTests.java
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/AllHeadlessTests.java
@@ -29,6 +29,7 @@ import org.junit.runners.Suite.SuiteClasses;
CommitFileTest.class, //
CommitServiceTest.class, //
CommitStatsTest.class, //
+ CommitStatusTest.class, //
CommitTest.class, //
CommitUserTest.class, //
ContributorTest.class, //
diff --git a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/CommitStatusTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/CommitStatusTest.java
new file mode 100644
index 00000000..0abb0275
--- /dev/null
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/CommitStatusTest.java
@@ -0,0 +1,62 @@
+/******************************************************************************
+ * 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 java.util.Date;
+
+import org.eclipse.egit.github.core.CommitStatus;
+import org.eclipse.egit.github.core.User;
+import org.junit.Test;
+
+/**
+ * Unit tests of {@link CommitStatus}
+ */
+public class CommitStatusTest {
+
+ /**
+ * Test default state of commit status
+ */
+ @Test
+ public void defaultState() {
+ CommitStatus status = new CommitStatus();
+ assertNull(status.getCreatedAt());
+ assertNull(status.getCreator());
+ assertNull(status.getDescription());
+ assertEquals(0, status.getId());
+ assertNull(status.getState());
+ assertNull(status.getTargetUrl());
+ assertNull(status.getUpdatedAt());
+ assertNull(status.getUrl());
+ }
+
+ /**
+ * Test updating commit status fields
+ */
+ @Test
+ public void updateFields() {
+ CommitStatus status = new CommitStatus();
+ assertEquals(new Date(1234), status.setCreatedAt(new Date(1234))
+ .getCreatedAt());
+ User creator = new User().setId(1);
+ assertEquals(creator, status.setCreator(creator).getCreator());
+ assertEquals("desc", status.setDescription("desc").getDescription());
+ assertEquals(40, status.setId(40).getId());
+ assertEquals("state", status.setState("state").getState());
+ assertEquals("targetUrl", status.setTargetUrl("targetUrl")
+ .getTargetUrl());
+ assertEquals(new Date(5678), status.setUpdatedAt(new Date(5678))
+ .getUpdatedAt());
+ assertEquals("url", status.setUrl("url").getUrl());
+ }
+}

Back to the top