summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Zarna2013-07-18 13:21:15 (EDT)
committerTomasz Zarna2013-07-18 13:21:15 (EDT)
commit1afa127a57b397921efc180838025b555c8c0ecc (patch)
tree10b8c68f4ea0dc400df4365e4392906a4ddc4846
parent6f429bc93ead1153af1a3b0d20a3f79bbfe7aacc (diff)
downloadorg.eclipse.mylyn.reviews-1afa127a57b397921efc180838025b555c8c0ecc.zip
org.eclipse.mylyn.reviews-1afa127a57b397921efc180838025b555c8c0ecc.tar.gz
org.eclipse.mylyn.reviews-1afa127a57b397921efc180838025b555c8c0ecc.tar.bz2
add a test for submitting a Changerefs/changes/63/14663/1
Change-Id: I8337ba7e7b3e229bf02181c481a533ed46efc053 Signed-off-by: Tomasz Zarna <tomasz.zarna@tasktop.com>
-rw-r--r--org.eclipse.mylyn.gerrit.tests/src/org/eclipse/mylyn/internal/gerrit/core/remote/GerritReviewRemoteFactoryTest.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.gerrit.tests/src/org/eclipse/mylyn/internal/gerrit/core/remote/GerritReviewRemoteFactoryTest.java b/org.eclipse.mylyn.gerrit.tests/src/org/eclipse/mylyn/internal/gerrit/core/remote/GerritReviewRemoteFactoryTest.java
index 9cfdf50..baf5043 100644
--- a/org.eclipse.mylyn.gerrit.tests/src/org/eclipse/mylyn/internal/gerrit/core/remote/GerritReviewRemoteFactoryTest.java
+++ b/org.eclipse.mylyn.gerrit.tests/src/org/eclipse/mylyn/internal/gerrit/core/remote/GerritReviewRemoteFactoryTest.java
@@ -32,6 +32,7 @@ import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jgit.api.CommitCommand;
import org.eclipse.mylyn.gerrit.tests.support.GerritProject.CommitResult;
import org.eclipse.mylyn.internal.gerrit.core.client.GerritChange;
+import org.eclipse.mylyn.internal.gerrit.core.client.GerritException;
import org.eclipse.mylyn.reviews.core.model.IApprovalType;
import org.eclipse.mylyn.reviews.core.model.IChange;
import org.eclipse.mylyn.reviews.core.model.IComment;
@@ -44,6 +45,7 @@ import org.eclipse.mylyn.reviews.core.model.IUser;
import org.eclipse.mylyn.reviews.core.model.RequirementStatus;
import org.eclipse.mylyn.reviews.core.model.ReviewStatus;
import org.eclipse.mylyn.reviews.core.spi.remote.emf.RemoteEmfConsumer;
+import org.eclipse.osgi.util.NLS;
import org.junit.Test;
import com.google.gerrit.reviewdb.ApprovalCategory;
@@ -215,4 +217,16 @@ public class GerritReviewRemoteFactoryTest extends GerritRemoteTest {
assertThat(lastComment.getAuthor().getDisplayName(), is("tests"));
assertThat(lastComment.getDescription(), is("Patch Set 1: Abandoned\n\n" + message1));
}
+
+ @Test
+ public void testCannotSubmitChange() throws Exception {
+ String message1 = "submit, time: " + System.currentTimeMillis(); //$NON-NLS-1$
+ try {
+ reviewHarness.client.submit(reviewHarness.shortId, 1, message1, new NullProgressMonitor());
+ fail("Expected to fail when submitting a change without approvals");
+ } catch (GerritException e) {
+ assertThat(e.getMessage(), is(NLS.bind(
+ "Cannot submit change {0}: needs Verified; change {0}: needs Code-Review", reviewHarness.shortId)));
+ }
+ }
}