summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Zarna2013-07-18 13:03:14 (EDT)
committerGerrit Code Review @ Eclipse.org2013-07-24 07:53:22 (EDT)
commit054f627e90dee5b2d5605258ec73c60b3bcc2018 (patch)
tree0a4022f89f67370e512519216f4b38dda8aba055
parenta341c81e70472252c2b24a51642a55f5e3bb6a59 (diff)
downloadorg.eclipse.mylyn.reviews-054f627e90dee5b2d5605258ec73c60b3bcc2018.zip
org.eclipse.mylyn.reviews-054f627e90dee5b2d5605258ec73c60b3bcc2018.tar.gz
org.eclipse.mylyn.reviews-054f627e90dee5b2d5605258ec73c60b3bcc2018.tar.bz2
add tests for restoring a changerefs/changes/61/14661/3
Change-Id: I1fb0c0cc3199333e8460561896809de7f6f04ab5 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.java31
1 files changed, 31 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 1daf410..c3effa6 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
@@ -221,6 +221,37 @@ public class GerritReviewRemoteFactoryTest extends GerritRemoteTest {
}
@Test
+ public void testRestoreChange() throws Exception {
+ String message1 = "abandon, time: " + System.currentTimeMillis();
+ reviewHarness.client.abandon(reviewHarness.shortId, 1, message1, new NullProgressMonitor());
+ reviewHarness.consumer.retrieve(false);
+ reviewHarness.listener.waitForResponse(2, 2);
+ String message2 = "restore, time: " + System.currentTimeMillis();
+
+ reviewHarness.client.restore(reviewHarness.shortId, 1, message2, new NullProgressMonitor());
+ reviewHarness.consumer.retrieve(false);
+ reviewHarness.listener.waitForResponse(3, 3);
+
+ assertThat(getReview().getState(), is(ReviewStatus.NEW));
+ List<IComment> comments = getReview().getComments();
+ assertThat(comments.size(), is(2)); // abandon + restore
+ IComment lastComment = comments.get(1);
+ assertThat(lastComment.getAuthor().getDisplayName(), is("tests"));
+ assertThat(lastComment.getDescription(), is("Patch Set 1: Restored\n\n" + message2));
+ }
+
+ @Test
+ public void testRestoreNewChange() throws Exception {
+ assertThat(getReview().getState(), is(ReviewStatus.NEW));
+ String message1 = "restore, time: " + System.currentTimeMillis();
+ try {
+ reviewHarness.client.restore(reviewHarness.shortId, 1, message1, new NullProgressMonitor());
+ fail("Expected to fail when restoring a new change");
+ } catch (GerritException e) {
+ assertThat(e.getMessage(), is("Not Found"));
+ }
+ }
+
public void testCannotSubmitChange() throws Exception {
String message1 = "submit, time: " + System.currentTimeMillis(); //$NON-NLS-1$
try {