ChangeJson: Add unit test for MESSAGES and CURRENT_REVISION options
In ac60c6e530d36622 a bug was introduced causing all revisions to be returned if the caller asked for both MESSAGES and CURRENT_REVISION. Add an unit test to ensure that only current revision is returned in this case. Change-Id: I85dcaecf45dfa2e4e9e28b8a94c555d31f73ae5d
This commit is contained in:
parent
d791e24d7e
commit
51c00067b1
@ -16,6 +16,7 @@ package com.google.gerrit.acceptance.rest.change;
|
|||||||
|
|
||||||
import static com.google.gerrit.extensions.common.ListChangesOption.ALL_REVISIONS;
|
import static com.google.gerrit.extensions.common.ListChangesOption.ALL_REVISIONS;
|
||||||
import static com.google.gerrit.extensions.common.ListChangesOption.CURRENT_REVISION;
|
import static com.google.gerrit.extensions.common.ListChangesOption.CURRENT_REVISION;
|
||||||
|
import static com.google.gerrit.extensions.common.ListChangesOption.MESSAGES;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.junit.Assert.assertNull;
|
||||||
|
|
||||||
@ -72,6 +73,15 @@ public class ListChangesOptionsIT extends AbstractDaemonTest {
|
|||||||
assertEquals(3, c.revisions.get(commitId(2))._number);
|
assertEquals(3, c.revisions.get(commitId(2))._number);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void currentRevisionAndMessages() throws Exception {
|
||||||
|
ChangeInfo c = get(changeId, CURRENT_REVISION, MESSAGES);
|
||||||
|
assertEquals(1, c.revisions.size());
|
||||||
|
assertEquals(commitId(2), c.currentRevision);
|
||||||
|
assertEquals(ImmutableSet.of(commitId(2)), c.revisions.keySet());
|
||||||
|
assertEquals(3, c.revisions.get(commitId(2))._number);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void allRevisions() throws Exception {
|
public void allRevisions() throws Exception {
|
||||||
ChangeInfo c = get(changeId, ALL_REVISIONS);
|
ChangeInfo c = get(changeId, ALL_REVISIONS);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user