Upgrade Truth to 0.26
Un-deprecates CollectionSubject, removing the need for many Iterable casts. Removes the Subject.is() method, which is replaced by either isEqualTo or isSameAs. Change-Id: I58d725b3cc84947e98a1f9b18cc8d2d160f01c97
This commit is contained in:
parent
9d8b1361ca
commit
2d726dd3d2
@ -67,12 +67,12 @@ public class AccountIT extends AbstractDaemonTest {
|
|||||||
String adminUsername = "admin";
|
String adminUsername = "admin";
|
||||||
List<AccountInfo> result = gApi.accounts()
|
List<AccountInfo> result = gApi.accounts()
|
||||||
.suggestAccounts().withQuery(adminUsername).get();
|
.suggestAccounts().withQuery(adminUsername).get();
|
||||||
assertThat(result.size()).is(1);
|
assertThat(result.size()).isEqualTo(1);
|
||||||
assertThat(result.get(0).username).isEqualTo(adminUsername);
|
assertThat(result.get(0).username).isEqualTo(adminUsername);
|
||||||
|
|
||||||
List<AccountInfo> resultShortcutApi = gApi.accounts()
|
List<AccountInfo> resultShortcutApi = gApi.accounts()
|
||||||
.suggestAccounts(adminUsername).get();
|
.suggestAccounts(adminUsername).get();
|
||||||
assertThat(resultShortcutApi.size()).is(result.size());
|
assertThat(resultShortcutApi.size()).isEqualTo(result.size());
|
||||||
|
|
||||||
List<AccountInfo> emptyResult = gApi.accounts()
|
List<AccountInfo> emptyResult = gApi.accounts()
|
||||||
.suggestAccounts("unknown").get();
|
.suggestAccounts("unknown").get();
|
||||||
|
@ -60,9 +60,9 @@ public class ChangeIT extends AbstractDaemonTest {
|
|||||||
assertThat(c.mergeable).isTrue();
|
assertThat(c.mergeable).isTrue();
|
||||||
assertThat(c.changeId).isEqualTo(r.getChangeId());
|
assertThat(c.changeId).isEqualTo(r.getChangeId());
|
||||||
assertThat(c.created).isEqualTo(c.updated);
|
assertThat(c.created).isEqualTo(c.updated);
|
||||||
assertThat(c._number).is(r.getChange().getId().get());
|
assertThat(c._number).isEqualTo(r.getChange().getId().get());
|
||||||
|
|
||||||
assertThat(c.owner._accountId).is(admin.getId().get());
|
assertThat(c.owner._accountId).isEqualTo(admin.getId().get());
|
||||||
assertThat(c.owner.name).isNull();
|
assertThat(c.owner.name).isNull();
|
||||||
assertThat(c.owner.email).isNull();
|
assertThat(c.owner.email).isNull();
|
||||||
assertThat(c.owner.username).isNull();
|
assertThat(c.owner.username).isNull();
|
||||||
@ -128,7 +128,7 @@ public class ChangeIT extends AbstractDaemonTest {
|
|||||||
.revision(r3.getCommit().name())
|
.revision(r3.getCommit().name())
|
||||||
.rebase(ri);
|
.rebase(ri);
|
||||||
PatchSet ps3 = r3.getPatchSet();
|
PatchSet ps3 = r3.getPatchSet();
|
||||||
assertThat(ps3.getId().get()).is(2);
|
assertThat(ps3.getId().get()).isEqualTo(2);
|
||||||
|
|
||||||
// rebase r2 onto r3 (referenced by ref)
|
// rebase r2 onto r3 (referenced by ref)
|
||||||
ri.base = ps3.getId().toRefName();
|
ri.base = ps3.getId().toRefName();
|
||||||
@ -137,7 +137,7 @@ public class ChangeIT extends AbstractDaemonTest {
|
|||||||
.revision(r2.getCommit().name())
|
.revision(r2.getCommit().name())
|
||||||
.rebase(ri);
|
.rebase(ri);
|
||||||
PatchSet ps2 = r2.getPatchSet();
|
PatchSet ps2 = r2.getPatchSet();
|
||||||
assertThat(ps2.getId().get()).is(2);
|
assertThat(ps2.getId().get()).isEqualTo(2);
|
||||||
|
|
||||||
// rebase r1 onto r2 (referenced by commit)
|
// rebase r1 onto r2 (referenced by commit)
|
||||||
ri.base = ps2.getRevision().get();
|
ri.base = ps2.getRevision().get();
|
||||||
@ -146,7 +146,7 @@ public class ChangeIT extends AbstractDaemonTest {
|
|||||||
.revision(r1.getCommit().name())
|
.revision(r1.getCommit().name())
|
||||||
.rebase(ri);
|
.rebase(ri);
|
||||||
PatchSet ps1 = r1.getPatchSet();
|
PatchSet ps1 = r1.getPatchSet();
|
||||||
assertThat(ps1.getId().get()).is(2);
|
assertThat(ps1.getId().get()).isEqualTo(2);
|
||||||
|
|
||||||
// rebase r1 onto r3 (referenced by change number)
|
// rebase r1 onto r3 (referenced by change number)
|
||||||
ri.base = String.valueOf(r3.getChange().getId().get());
|
ri.base = String.valueOf(r3.getChange().getId().get());
|
||||||
@ -154,7 +154,7 @@ public class ChangeIT extends AbstractDaemonTest {
|
|||||||
.id(r1.getChangeId())
|
.id(r1.getChangeId())
|
||||||
.revision(ps1.getRevision().get())
|
.revision(ps1.getRevision().get())
|
||||||
.rebase(ri);
|
.rebase(ri);
|
||||||
assertThat(r1.getPatchSetId().get()).is(3);
|
assertThat(r1.getPatchSetId().get()).isEqualTo(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = ResourceConflictException.class)
|
@Test(expected = ResourceConflictException.class)
|
||||||
@ -190,7 +190,7 @@ public class ChangeIT extends AbstractDaemonTest {
|
|||||||
.id(r.getChangeId())
|
.id(r.getChangeId())
|
||||||
.addReviewer(in);
|
.addReviewer(in);
|
||||||
|
|
||||||
assertThat((Iterable<?>)getReviewers(r.getChangeId()))
|
assertThat(getReviewers(r.getChangeId()))
|
||||||
.containsExactlyElementsIn(ImmutableSet.of(user.id));
|
.containsExactlyElementsIn(ImmutableSet.of(user.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ public class ChangeIT extends AbstractDaemonTest {
|
|||||||
.revision(r.getCommit().name())
|
.revision(r.getCommit().name())
|
||||||
.submit();
|
.submit();
|
||||||
|
|
||||||
assertThat((Iterable<?>)getReviewers(r.getChangeId()))
|
assertThat(getReviewers(r.getChangeId()))
|
||||||
.containsExactlyElementsIn(ImmutableSet.of(admin.getId()));
|
.containsExactlyElementsIn(ImmutableSet.of(admin.getId()));
|
||||||
|
|
||||||
AddReviewerInput in = new AddReviewerInput();
|
AddReviewerInput in = new AddReviewerInput();
|
||||||
@ -214,7 +214,7 @@ public class ChangeIT extends AbstractDaemonTest {
|
|||||||
gApi.changes()
|
gApi.changes()
|
||||||
.id(r.getChangeId())
|
.id(r.getChangeId())
|
||||||
.addReviewer(in);
|
.addReviewer(in);
|
||||||
assertThat((Iterable<?>)getReviewers(r.getChangeId()))
|
assertThat(getReviewers(r.getChangeId()))
|
||||||
.containsExactlyElementsIn(ImmutableSet.of(admin.getId(), user.id));
|
.containsExactlyElementsIn(ImmutableSet.of(admin.getId(), user.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,7 +293,7 @@ public class ChangeIT extends AbstractDaemonTest {
|
|||||||
PushOneCommit.Result r = createChange();
|
PushOneCommit.Result r = createChange();
|
||||||
ChangeInfo result = Iterables.getOnlyElement(query(r.getChangeId()));
|
ChangeInfo result = Iterables.getOnlyElement(query(r.getChangeId()));
|
||||||
assertThat(result.labels).isNull();
|
assertThat(result.labels).isNull();
|
||||||
assertThat((Iterable<?>)result.messages).isNull();
|
assertThat(result.messages).isNull();
|
||||||
assertThat(result.revisions).isNull();
|
assertThat(result.revisions).isNull();
|
||||||
assertThat(result.actions).isNull();
|
assertThat(result.actions).isNull();
|
||||||
}
|
}
|
||||||
@ -307,13 +307,13 @@ public class ChangeIT extends AbstractDaemonTest {
|
|||||||
.get());
|
.get());
|
||||||
assertThat(Iterables.getOnlyElement(result.labels.keySet()))
|
assertThat(Iterables.getOnlyElement(result.labels.keySet()))
|
||||||
.isEqualTo("Code-Review");
|
.isEqualTo("Code-Review");
|
||||||
assertThat((Iterable<?>)result.messages).hasSize(1);
|
assertThat(result.messages).hasSize(1);
|
||||||
assertThat(result.actions).isNotEmpty();
|
assertThat(result.actions).isNotEmpty();
|
||||||
|
|
||||||
RevisionInfo rev = Iterables.getOnlyElement(result.revisions.values());
|
RevisionInfo rev = Iterables.getOnlyElement(result.revisions.values());
|
||||||
assertThat(rev._number).isEqualTo(r.getPatchSetId().get());
|
assertThat(rev._number).isEqualTo(r.getPatchSetId().get());
|
||||||
assertThat(rev.created).isNotNull();
|
assertThat(rev.created).isNotNull();
|
||||||
assertThat(rev.uploader._accountId).is(admin.getId().get());
|
assertThat(rev.uploader._accountId).isEqualTo(admin.getId().get());
|
||||||
assertThat(rev.ref).isEqualTo(r.getPatchSetId().toRefName());
|
assertThat(rev.ref).isEqualTo(r.getPatchSetId().toRefName());
|
||||||
assertThat(rev.actions).isNotEmpty();
|
assertThat(rev.actions).isNotEmpty();
|
||||||
}
|
}
|
||||||
|
@ -387,7 +387,7 @@ public class GroupsIT extends AbstractDaemonTest {
|
|||||||
}
|
}
|
||||||
}).toSortedList(Ordering.natural());
|
}).toSortedList(Ordering.natural());
|
||||||
assertThat(expectedGroups.size()).isAtLeast(2);
|
assertThat(expectedGroups.size()).isAtLeast(2);
|
||||||
assertThat((Iterable<?>) gApi.groups().list().getAsMap().keySet())
|
assertThat(gApi.groups().list().getAsMap().keySet())
|
||||||
.containsExactlyElementsIn(expectedGroups).inOrder();
|
.containsExactlyElementsIn(expectedGroups).inOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,10 +153,10 @@ public class RevisionIT extends AbstractDaemonTest {
|
|||||||
ChangeApi orig = gApi.changes()
|
ChangeApi orig = gApi.changes()
|
||||||
.id(project.get() + "~master~" + r.getChangeId());
|
.id(project.get() + "~master~" + r.getChangeId());
|
||||||
|
|
||||||
assertThat((Iterable<?>)orig.get().messages).hasSize(1);
|
assertThat(orig.get().messages).hasSize(1);
|
||||||
ChangeApi cherry = orig.revision(r.getCommit().name())
|
ChangeApi cherry = orig.revision(r.getCommit().name())
|
||||||
.cherryPick(in);
|
.cherryPick(in);
|
||||||
assertThat((Iterable<?>)orig.get().messages).hasSize(2);
|
assertThat(orig.get().messages).hasSize(2);
|
||||||
|
|
||||||
String cherryPickedRevision = cherry.get().currentRevision;
|
String cherryPickedRevision = cherry.get().currentRevision;
|
||||||
String expectedMessage = String.format(
|
String expectedMessage = String.format(
|
||||||
@ -168,7 +168,7 @@ public class RevisionIT extends AbstractDaemonTest {
|
|||||||
origIt.next();
|
origIt.next();
|
||||||
assertThat(origIt.next().message).isEqualTo(expectedMessage);
|
assertThat(origIt.next().message).isEqualTo(expectedMessage);
|
||||||
|
|
||||||
assertThat((Iterable<?>)cherry.get().messages).hasSize(1);
|
assertThat(cherry.get().messages).hasSize(1);
|
||||||
Iterator<ChangeMessageInfo> cherryIt = cherry.get().messages.iterator();
|
Iterator<ChangeMessageInfo> cherryIt = cherry.get().messages.iterator();
|
||||||
expectedMessage = "Patch Set 1: Cherry Picked from branch master.";
|
expectedMessage = "Patch Set 1: Cherry Picked from branch master.";
|
||||||
assertThat(cherryIt.next().message).isEqualTo(expectedMessage);
|
assertThat(cherryIt.next().message).isEqualTo(expectedMessage);
|
||||||
@ -190,7 +190,7 @@ public class RevisionIT extends AbstractDaemonTest {
|
|||||||
.revision(r.getCommit().name())
|
.revision(r.getCommit().name())
|
||||||
.cherryPick(in)
|
.cherryPick(in)
|
||||||
.get();
|
.get();
|
||||||
assertThat((Iterable<?>)cherryInfo.messages).hasSize(2);
|
assertThat(cherryInfo.messages).hasSize(2);
|
||||||
Iterator<ChangeMessageInfo> cherryIt = cherryInfo.messages.iterator();
|
Iterator<ChangeMessageInfo> cherryIt = cherryInfo.messages.iterator();
|
||||||
assertThat(cherryIt.next().message).isEqualTo("Uploaded patch set 1.");
|
assertThat(cherryIt.next().message).isEqualTo("Uploaded patch set 1.");
|
||||||
assertThat(cherryIt.next().message).isEqualTo("Uploaded patch set 2.");
|
assertThat(cherryIt.next().message).isEqualTo("Uploaded patch set 2.");
|
||||||
@ -228,7 +228,7 @@ public class RevisionIT extends AbstractDaemonTest {
|
|||||||
in.message = subject;
|
in.message = subject;
|
||||||
ChangeApi cherry = orig.revision(r2.getCommit().name()).cherryPick(in);
|
ChangeApi cherry = orig.revision(r2.getCommit().name()).cherryPick(in);
|
||||||
ChangeInfo cherryInfo = cherry.get();
|
ChangeInfo cherryInfo = cherry.get();
|
||||||
assertThat((Iterable<?>)cherryInfo.messages).hasSize(2);
|
assertThat(cherryInfo.messages).hasSize(2);
|
||||||
Iterator<ChangeMessageInfo> cherryIt = cherryInfo.messages.iterator();
|
Iterator<ChangeMessageInfo> cherryIt = cherryInfo.messages.iterator();
|
||||||
assertThat(cherryIt.next().message).isEqualTo("Uploaded patch set 1.");
|
assertThat(cherryIt.next().message).isEqualTo("Uploaded patch set 1.");
|
||||||
assertThat(cherryIt.next().message).isEqualTo("Uploaded patch set 2.");
|
assertThat(cherryIt.next().message).isEqualTo("Uploaded patch set 2.");
|
||||||
@ -253,10 +253,10 @@ public class RevisionIT extends AbstractDaemonTest {
|
|||||||
ChangeApi orig = gApi.changes()
|
ChangeApi orig = gApi.changes()
|
||||||
.id(project.get() + "~master~" + r.getChangeId());
|
.id(project.get() + "~master~" + r.getChangeId());
|
||||||
|
|
||||||
assertThat((Iterable<?>)orig.get().messages).hasSize(1);
|
assertThat(orig.get().messages).hasSize(1);
|
||||||
ChangeApi cherry = orig.revision(r.getCommit().name())
|
ChangeApi cherry = orig.revision(r.getCommit().name())
|
||||||
.cherryPick(in);
|
.cherryPick(in);
|
||||||
assertThat((Iterable<?>)orig.get().messages).hasSize(2);
|
assertThat(orig.get().messages).hasSize(2);
|
||||||
|
|
||||||
assertThat(cherry.get().subject).contains(in.message);
|
assertThat(cherry.get().subject).contains(in.message);
|
||||||
cherry.current().review(ReviewInput.approve());
|
cherry.current().review(ReviewInput.approve());
|
||||||
@ -288,7 +288,7 @@ public class RevisionIT extends AbstractDaemonTest {
|
|||||||
|
|
||||||
String triplet = project.get() + "~master~" + r.getChangeId();
|
String triplet = project.get() + "~master~" + r.getChangeId();
|
||||||
ChangeApi orig = gApi.changes().id(triplet);
|
ChangeApi orig = gApi.changes().id(triplet);
|
||||||
assertThat((Iterable<?>)orig.get().messages).hasSize(1);
|
assertThat(orig.get().messages).hasSize(1);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
orig.revision(r.getCommit().name()).cherryPick(in);
|
orig.revision(r.getCommit().name()).cherryPick(in);
|
||||||
@ -345,7 +345,7 @@ public class RevisionIT extends AbstractDaemonTest {
|
|||||||
.current()
|
.current()
|
||||||
.setReviewed(PushOneCommit.FILE_NAME, false);
|
.setReviewed(PushOneCommit.FILE_NAME, false);
|
||||||
|
|
||||||
assertThat((Iterable<?>)gApi.changes().id(r.getChangeId()).current().reviewed())
|
assertThat(gApi.changes().id(r.getChangeId()).current().reviewed())
|
||||||
.isEmpty();
|
.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
|
|||||||
LabelInfo cr = ci.labels.get("Code-Review");
|
LabelInfo cr = ci.labels.get("Code-Review");
|
||||||
assertThat(cr.all).hasSize(1);
|
assertThat(cr.all).hasSize(1);
|
||||||
assertThat(cr.all.get(0).name).isEqualTo("Administrator");
|
assertThat(cr.all.get(0).name).isEqualTo("Administrator");
|
||||||
assertThat(cr.all.get(0).value).is(1);
|
assertThat(cr.all.get(0).value).isEqualTo(1);
|
||||||
|
|
||||||
PushOneCommit push =
|
PushOneCommit push =
|
||||||
pushFactory.create(db, admin.getIdent(), testRepo, PushOneCommit.SUBJECT,
|
pushFactory.create(db, admin.getIdent(), testRepo, PushOneCommit.SUBJECT,
|
||||||
@ -186,7 +186,7 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
|
|||||||
cr = ci.labels.get("Code-Review");
|
cr = ci.labels.get("Code-Review");
|
||||||
assertThat(cr.all).hasSize(1);
|
assertThat(cr.all).hasSize(1);
|
||||||
assertThat(cr.all.get(0).name).isEqualTo("Administrator");
|
assertThat(cr.all.get(0).name).isEqualTo("Administrator");
|
||||||
assertThat(cr.all.get(0).value).is(2);
|
assertThat(cr.all.get(0).value).isEqualTo(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -233,7 +233,7 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
|
|||||||
r.assertChange(Change.Status.NEW, null);
|
r.assertChange(Change.Status.NEW, null);
|
||||||
|
|
||||||
Set<String> hashtags = gApi.changes().id(r.getChangeId()).getHashtags();
|
Set<String> hashtags = gApi.changes().id(r.getChangeId()).getHashtags();
|
||||||
assertThat((Iterable<?>)hashtags).containsExactlyElementsIn(expected);
|
assertThat(hashtags).containsExactlyElementsIn(expected);
|
||||||
|
|
||||||
// specify a single hashtag as option in new patch set
|
// specify a single hashtag as option in new patch set
|
||||||
String hashtag2 = "tag2";
|
String hashtag2 = "tag2";
|
||||||
@ -244,7 +244,7 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
|
|||||||
r.assertOkStatus();
|
r.assertOkStatus();
|
||||||
expected = ImmutableSet.of(hashtag1, hashtag2);
|
expected = ImmutableSet.of(hashtag1, hashtag2);
|
||||||
hashtags = gApi.changes().id(r.getChangeId()).getHashtags();
|
hashtags = gApi.changes().id(r.getChangeId()).getHashtags();
|
||||||
assertThat((Iterable<?>)hashtags).containsExactlyElementsIn(expected);
|
assertThat(hashtags).containsExactlyElementsIn(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -263,7 +263,7 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
|
|||||||
r.assertChange(Change.Status.NEW, null);
|
r.assertChange(Change.Status.NEW, null);
|
||||||
|
|
||||||
Set<String> hashtags = gApi.changes().id(r.getChangeId()).getHashtags();
|
Set<String> hashtags = gApi.changes().id(r.getChangeId()).getHashtags();
|
||||||
assertThat((Iterable<?>)hashtags).containsExactlyElementsIn(expected);
|
assertThat(hashtags).containsExactlyElementsIn(expected);
|
||||||
|
|
||||||
// specify multiple hashtags as options in new patch set
|
// specify multiple hashtags as options in new patch set
|
||||||
String hashtag3 = "tag3";
|
String hashtag3 = "tag3";
|
||||||
@ -275,7 +275,7 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
|
|||||||
r.assertOkStatus();
|
r.assertOkStatus();
|
||||||
expected = ImmutableSet.of(hashtag1, hashtag2, hashtag3, hashtag4);
|
expected = ImmutableSet.of(hashtag1, hashtag2, hashtag3, hashtag4);
|
||||||
hashtags = gApi.changes().id(r.getChangeId()).getHashtags();
|
hashtags = gApi.changes().id(r.getChangeId()).getHashtags();
|
||||||
assertThat((Iterable<?>)hashtags).containsExactlyElementsIn(expected);
|
assertThat(hashtags).containsExactlyElementsIn(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -253,7 +253,7 @@ public class SubmitOnPushIT extends AbstractDaemonTest {
|
|||||||
try (Repository r = repoManager.openRepository(project);
|
try (Repository r = repoManager.openRepository(project);
|
||||||
RevWalk rw = new RevWalk(r)) {
|
RevWalk rw = new RevWalk(r)) {
|
||||||
RevCommit c = rw.parseCommit(r.getRef(branch).getObjectId());
|
RevCommit c = rw.parseCommit(r.getRef(branch).getObjectId());
|
||||||
assertThat(c.getParentCount()).is(2);
|
assertThat(c.getParentCount()).isEqualTo(2);
|
||||||
assertThat(c.getShortMessage()).isEqualTo("Merge \"" + subject + "\"");
|
assertThat(c.getShortMessage()).isEqualTo("Merge \"" + subject + "\"");
|
||||||
assertThat(c.getAuthorIdent().getEmailAddress()).isEqualTo(admin.email);
|
assertThat(c.getAuthorIdent().getEmailAddress()).isEqualTo(admin.email);
|
||||||
assertThat(c.getCommitterIdent().getEmailAddress()).isEqualTo(
|
assertThat(c.getCommitterIdent().getEmailAddress()).isEqualTo(
|
||||||
|
@ -280,7 +280,7 @@ public class VisibleRefFilterIT extends AbstractDaemonTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Splitter s = Splitter.on(CharMatcher.WHITESPACE).omitEmptyStrings();
|
Splitter s = Splitter.on(CharMatcher.WHITESPACE).omitEmptyStrings();
|
||||||
assertThat(filtered).containsSequence(
|
assertThat(filtered).containsExactlyElementsIn(
|
||||||
Ordering.natural().sortedCopy(s.split(out)));
|
Ordering.natural().sortedCopy(s.split(out))).inOrder();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,8 +152,8 @@ public abstract class AbstractSubmit extends AbstractDaemonTest {
|
|||||||
|
|
||||||
private void assertSubmitter(PushOneCommit.Result change) throws Exception {
|
private void assertSubmitter(PushOneCommit.Result change) throws Exception {
|
||||||
ChangeInfo info = get(change.getChangeId(), ListChangesOption.MESSAGES);
|
ChangeInfo info = get(change.getChangeId(), ListChangesOption.MESSAGES);
|
||||||
assertThat((Iterable<?>)info.messages).isNotNull();
|
assertThat(info.messages).isNotNull();
|
||||||
assertThat((Iterable<?>)info.messages).hasSize(3);
|
assertThat(info.messages).hasSize(3);
|
||||||
if (getSubmitType() == SubmitType.CHERRY_PICK) {
|
if (getSubmitType() == SubmitType.CHERRY_PICK) {
|
||||||
assertThat(Iterables.getLast(info.messages).message).startsWith(
|
assertThat(Iterables.getLast(info.messages).message).startsWith(
|
||||||
"Change has been successfully cherry-picked as ");
|
"Change has been successfully cherry-picked as ");
|
||||||
|
@ -73,15 +73,15 @@ public class ChangeMessagesIT extends AbstractDaemonTest {
|
|||||||
String changeId = createChange().getChangeId();
|
String changeId = createChange().getChangeId();
|
||||||
postMessage(changeId, "Some nits need to be fixed.");
|
postMessage(changeId, "Some nits need to be fixed.");
|
||||||
ChangeInfo c = info(changeId);
|
ChangeInfo c = info(changeId);
|
||||||
assertThat((Iterable<?>)c.messages).isNull();
|
assertThat(c.messages).isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void defaultMessage() throws Exception {
|
public void defaultMessage() throws Exception {
|
||||||
String changeId = createChange().getChangeId();
|
String changeId = createChange().getChangeId();
|
||||||
ChangeInfo c = get(changeId);
|
ChangeInfo c = get(changeId);
|
||||||
assertThat((Iterable<?>)c.messages).isNotNull();
|
assertThat(c.messages).isNotNull();
|
||||||
assertThat((Iterable<?>)c.messages).hasSize(1);
|
assertThat(c.messages).hasSize(1);
|
||||||
assertThat(c.messages.iterator().next().message)
|
assertThat(c.messages.iterator().next().message)
|
||||||
.isEqualTo("Uploaded patch set 1.");
|
.isEqualTo("Uploaded patch set 1.");
|
||||||
}
|
}
|
||||||
@ -94,8 +94,8 @@ public class ChangeMessagesIT extends AbstractDaemonTest {
|
|||||||
String secondMessage = "I like this feature.";
|
String secondMessage = "I like this feature.";
|
||||||
postMessage(changeId, secondMessage);
|
postMessage(changeId, secondMessage);
|
||||||
ChangeInfo c = get(changeId);
|
ChangeInfo c = get(changeId);
|
||||||
assertThat((Iterable<?>)c.messages).isNotNull();
|
assertThat(c.messages).isNotNull();
|
||||||
assertThat((Iterable<?>)c.messages).hasSize(3);
|
assertThat(c.messages).hasSize(3);
|
||||||
Iterator<ChangeMessageInfo> it = c.messages.iterator();
|
Iterator<ChangeMessageInfo> it = c.messages.iterator();
|
||||||
assertThat(it.next().message).isEqualTo("Uploaded patch set 1.");
|
assertThat(it.next().message).isEqualTo("Uploaded patch set 1.");
|
||||||
assertMessage(firstMessage, it.next().message);
|
assertMessage(firstMessage, it.next().message);
|
||||||
|
@ -196,7 +196,7 @@ public class HashtagsIT extends AbstractDaemonTest {
|
|||||||
? extends IterableSubject<?, String, Iterable<String>>,
|
? extends IterableSubject<?, String, Iterable<String>>,
|
||||||
String, Iterable<String>>
|
String, Iterable<String>>
|
||||||
assertThatGet(PushOneCommit.Result r) throws Exception {
|
assertThatGet(PushOneCommit.Result r) throws Exception {
|
||||||
return assertThat((Iterable<String>) gApi.changes()
|
return assertThat(gApi.changes()
|
||||||
.id(r.getChange().getId().get())
|
.id(r.getChange().getId().get())
|
||||||
.getHashtags());
|
.getHashtags());
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ public class ListChangesOptionsIT extends AbstractDaemonTest {
|
|||||||
public void currentRevision() throws Exception {
|
public void currentRevision() throws Exception {
|
||||||
ChangeInfo c = get(changeId, CURRENT_REVISION);
|
ChangeInfo c = get(changeId, CURRENT_REVISION);
|
||||||
assertThat(c.currentRevision).isEqualTo(commitId(2));
|
assertThat(c.currentRevision).isEqualTo(commitId(2));
|
||||||
assertThat((Iterable<?>)c.revisions.keySet()).containsAllIn(
|
assertThat(c.revisions.keySet()).containsAllIn(
|
||||||
ImmutableSet.of(commitId(2)));
|
ImmutableSet.of(commitId(2)));
|
||||||
assertThat(c.revisions.get(commitId(2))._number).isEqualTo(3);
|
assertThat(c.revisions.get(commitId(2))._number).isEqualTo(3);
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ public class ListChangesOptionsIT extends AbstractDaemonTest {
|
|||||||
ChangeInfo c = get(changeId, CURRENT_REVISION, MESSAGES);
|
ChangeInfo c = get(changeId, CURRENT_REVISION, MESSAGES);
|
||||||
assertThat(c.revisions).hasSize(1);
|
assertThat(c.revisions).hasSize(1);
|
||||||
assertThat(c.currentRevision).isEqualTo(commitId(2));
|
assertThat(c.currentRevision).isEqualTo(commitId(2));
|
||||||
assertThat((Iterable<?>)c.revisions.keySet()).containsAllIn(
|
assertThat(c.revisions.keySet()).containsAllIn(
|
||||||
ImmutableSet.of(commitId(2)));
|
ImmutableSet.of(commitId(2)));
|
||||||
assertThat(c.revisions.get(commitId(2))._number).isEqualTo(3);
|
assertThat(c.revisions.get(commitId(2))._number).isEqualTo(3);
|
||||||
}
|
}
|
||||||
@ -87,7 +87,7 @@ public class ListChangesOptionsIT extends AbstractDaemonTest {
|
|||||||
public void allRevisions() throws Exception {
|
public void allRevisions() throws Exception {
|
||||||
ChangeInfo c = get(changeId, ALL_REVISIONS);
|
ChangeInfo c = get(changeId, ALL_REVISIONS);
|
||||||
assertThat(c.currentRevision).isEqualTo(commitId(2));
|
assertThat(c.currentRevision).isEqualTo(commitId(2));
|
||||||
assertThat((Iterable<?>)c.revisions.keySet()).containsAllIn(
|
assertThat(c.revisions.keySet()).containsAllIn(
|
||||||
ImmutableSet.of(commitId(0), commitId(1), commitId(2)));
|
ImmutableSet.of(commitId(0), commitId(1), commitId(2)));
|
||||||
assertThat(c.revisions.get(commitId(0))._number).isEqualTo(1);
|
assertThat(c.revisions.get(commitId(0))._number).isEqualTo(1);
|
||||||
assertThat(c.revisions.get(commitId(1))._number).isEqualTo(2);
|
assertThat(c.revisions.get(commitId(1))._number).isEqualTo(2);
|
||||||
|
@ -75,6 +75,6 @@ public class ProjectAssert {
|
|||||||
for (AccountGroup.UUID g : state.getOwners()) {
|
for (AccountGroup.UUID g : state.getOwners()) {
|
||||||
assertThat(expectedOwners.remove(g)).isTrue();
|
assertThat(expectedOwners.remove(g)).isTrue();
|
||||||
}
|
}
|
||||||
assertThat((Iterable<?>)expectedOwners).isEmpty();
|
assertThat(expectedOwners).isEmpty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,45 +23,45 @@ import org.junit.Test;
|
|||||||
public class HashtagsTest {
|
public class HashtagsTest {
|
||||||
@Test
|
@Test
|
||||||
public void emptyCommitMessage() throws Exception {
|
public void emptyCommitMessage() throws Exception {
|
||||||
assertThat((Iterable<?>)HashtagsUtil.extractTags("")).isEmpty();
|
assertThat(HashtagsUtil.extractTags("")).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void nullCommitMessage() throws Exception {
|
public void nullCommitMessage() throws Exception {
|
||||||
assertThat((Iterable<?>)HashtagsUtil.extractTags(null)).isEmpty();
|
assertThat(HashtagsUtil.extractTags(null)).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void noHashtags() throws Exception {
|
public void noHashtags() throws Exception {
|
||||||
String commitMessage = "Subject\n\nLine 1\n\nLine 2";
|
String commitMessage = "Subject\n\nLine 1\n\nLine 2";
|
||||||
assertThat((Iterable<?>)HashtagsUtil.extractTags(commitMessage)).isEmpty();
|
assertThat(HashtagsUtil.extractTags(commitMessage)).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void singleHashtag() throws Exception {
|
public void singleHashtag() throws Exception {
|
||||||
String commitMessage = "#Subject\n\nLine 1\n\nLine 2";
|
String commitMessage = "#Subject\n\nLine 1\n\nLine 2";
|
||||||
assertThat((Iterable<?>)HashtagsUtil.extractTags(commitMessage))
|
assertThat(HashtagsUtil.extractTags(commitMessage))
|
||||||
.containsExactlyElementsIn(Sets.newHashSet("Subject"));
|
.containsExactlyElementsIn(Sets.newHashSet("Subject"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void singleHashtagNumeric() throws Exception {
|
public void singleHashtagNumeric() throws Exception {
|
||||||
String commitMessage = "Subject\n\n#123\n\nLine 2";
|
String commitMessage = "Subject\n\n#123\n\nLine 2";
|
||||||
assertThat((Iterable<?>)HashtagsUtil.extractTags(commitMessage))
|
assertThat(HashtagsUtil.extractTags(commitMessage))
|
||||||
.containsExactlyElementsIn(Sets.newHashSet("123"));
|
.containsExactlyElementsIn(Sets.newHashSet("123"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void multipleHashtags() throws Exception {
|
public void multipleHashtags() throws Exception {
|
||||||
String commitMessage = "#Subject\n\n#Hashtag\n\nLine 2";
|
String commitMessage = "#Subject\n\n#Hashtag\n\nLine 2";
|
||||||
assertThat((Iterable<?>)HashtagsUtil.extractTags(commitMessage))
|
assertThat(HashtagsUtil.extractTags(commitMessage))
|
||||||
.containsExactlyElementsIn(Sets.newHashSet("Subject", "Hashtag"));
|
.containsExactlyElementsIn(Sets.newHashSet("Subject", "Hashtag"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void repeatedHashtag() throws Exception {
|
public void repeatedHashtag() throws Exception {
|
||||||
String commitMessage = "#Subject\n\n#Hashtag1\n\n#Hashtag2\n\n#Hashtag1";
|
String commitMessage = "#Subject\n\n#Hashtag1\n\n#Hashtag2\n\n#Hashtag1";
|
||||||
assertThat((Iterable<?>)HashtagsUtil.extractTags(commitMessage))
|
assertThat(HashtagsUtil.extractTags(commitMessage))
|
||||||
.containsExactlyElementsIn(
|
.containsExactlyElementsIn(
|
||||||
Sets.newHashSet("Subject", "Hashtag1", "Hashtag2"));
|
Sets.newHashSet("Subject", "Hashtag1", "Hashtag2"));
|
||||||
}
|
}
|
||||||
@ -69,21 +69,21 @@ public class HashtagsTest {
|
|||||||
@Test
|
@Test
|
||||||
public void multipleHashtagsNoSpaces() throws Exception {
|
public void multipleHashtagsNoSpaces() throws Exception {
|
||||||
String commitMessage = "Subject\n\n#Hashtag1#Hashtag2";
|
String commitMessage = "Subject\n\n#Hashtag1#Hashtag2";
|
||||||
assertThat((Iterable<?>)HashtagsUtil.extractTags(commitMessage))
|
assertThat(HashtagsUtil.extractTags(commitMessage))
|
||||||
.containsExactlyElementsIn(Sets.newHashSet("Hashtag1"));
|
.containsExactlyElementsIn(Sets.newHashSet("Hashtag1"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void hyphenatedHashtag() throws Exception {
|
public void hyphenatedHashtag() throws Exception {
|
||||||
String commitMessage = "Subject\n\n#Hyphenated-Hashtag";
|
String commitMessage = "Subject\n\n#Hyphenated-Hashtag";
|
||||||
assertThat((Iterable<?>)HashtagsUtil.extractTags(commitMessage))
|
assertThat(HashtagsUtil.extractTags(commitMessage))
|
||||||
.containsExactlyElementsIn(Sets.newHashSet("Hyphenated-Hashtag"));
|
.containsExactlyElementsIn(Sets.newHashSet("Hyphenated-Hashtag"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void underscoredHashtag() throws Exception {
|
public void underscoredHashtag() throws Exception {
|
||||||
String commitMessage = "Subject\n\n#Underscored_Hashtag";
|
String commitMessage = "Subject\n\n#Underscored_Hashtag";
|
||||||
assertThat((Iterable<?>)HashtagsUtil.extractTags(commitMessage))
|
assertThat(HashtagsUtil.extractTags(commitMessage))
|
||||||
.containsExactlyElementsIn(Sets.newHashSet("Underscored_Hashtag"));
|
.containsExactlyElementsIn(Sets.newHashSet("Underscored_Hashtag"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ public class HashtagsTest {
|
|||||||
public void hashtagsWithAccentedCharacters() throws Exception {
|
public void hashtagsWithAccentedCharacters() throws Exception {
|
||||||
String commitMessage = "Jag #måste #öva på min #Svenska!\n\n"
|
String commitMessage = "Jag #måste #öva på min #Svenska!\n\n"
|
||||||
+ "Jag behöver en #läkare.";
|
+ "Jag behöver en #läkare.";
|
||||||
assertThat((Iterable<?>)HashtagsUtil.extractTags(commitMessage))
|
assertThat(HashtagsUtil.extractTags(commitMessage))
|
||||||
.containsExactlyElementsIn(
|
.containsExactlyElementsIn(
|
||||||
Sets.newHashSet("måste", "öva", "Svenska", "läkare"));
|
Sets.newHashSet("måste", "öva", "Svenska", "läkare"));
|
||||||
}
|
}
|
||||||
@ -99,6 +99,6 @@ public class HashtagsTest {
|
|||||||
@Test
|
@Test
|
||||||
public void hashWithoutHashtag() throws Exception {
|
public void hashWithoutHashtag() throws Exception {
|
||||||
String commitMessage = "Subject\n\n# Text";
|
String commitMessage = "Subject\n\n# Text";
|
||||||
assertThat((Iterable<?>)HashtagsUtil.extractTags(commitMessage)).isEmpty();
|
assertThat(HashtagsUtil.extractTags(commitMessage)).isEmpty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ public class LocalDiskRepositoryManagerTest extends EasyMockSupport {
|
|||||||
try (Repository repo = repoManager.openRepository(projectA)) {
|
try (Repository repo = repoManager.openRepository(projectA)) {
|
||||||
assertThat(repo).isNotNull();
|
assertThat(repo).isNotNull();
|
||||||
}
|
}
|
||||||
assertThat((Iterable<?>) repoManager.list()).containsExactly(projectA);
|
assertThat(repoManager.list()).containsExactly(projectA);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = RepositoryNotFoundException.class)
|
@Test(expected = RepositoryNotFoundException.class)
|
||||||
@ -174,7 +174,7 @@ public class LocalDiskRepositoryManagerTest extends EasyMockSupport {
|
|||||||
try (Repository repo = repoManager.openRepository(projectA)) {
|
try (Repository repo = repoManager.openRepository(projectA)) {
|
||||||
assertThat(repo).isNotNull();
|
assertThat(repo).isNotNull();
|
||||||
}
|
}
|
||||||
assertThat((Iterable<?>) repoManager.list()).containsExactly(projectA);
|
assertThat(repoManager.list()).containsExactly(projectA);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = RepositoryNotFoundException.class)
|
@Test(expected = RepositoryNotFoundException.class)
|
||||||
@ -196,8 +196,8 @@ public class LocalDiskRepositoryManagerTest extends EasyMockSupport {
|
|||||||
repoManager.getBasePath().resolve(".git").toFile().mkdir();
|
repoManager.getBasePath().resolve(".git").toFile().mkdir();
|
||||||
// create an invalid repo name
|
// create an invalid repo name
|
||||||
createRepository(repoManager.getBasePath(), "project?A");
|
createRepository(repoManager.getBasePath(), "project?A");
|
||||||
assertThat((Iterable<?>) repoManager.list()).containsExactly(projectA,
|
assertThat(repoManager.list())
|
||||||
projectB, projectC);
|
.containsExactly(projectA, projectB, projectC);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1126,8 +1126,7 @@ public abstract class AbstractQueryChangesTest {
|
|||||||
|
|
||||||
protected void assertQuery(QueryRequest query, Change... changes)
|
protected void assertQuery(QueryRequest query, Change... changes)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
assertThat((Iterable<Integer>) query(query))
|
assertThat(query(query)).named(query.toString())
|
||||||
.named(query.toString())
|
|
||||||
.containsExactlyElementsIn(ids(changes)).inOrder();
|
.containsExactlyElementsIn(ids(changes)).inOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
lib/BUCK
4
lib/BUCK
@ -188,8 +188,8 @@ maven_jar(
|
|||||||
|
|
||||||
maven_jar(
|
maven_jar(
|
||||||
name = 'truth',
|
name = 'truth',
|
||||||
id = 'com.google.truth:truth:0.25',
|
id = 'com.google.truth:truth:0.26',
|
||||||
sha1 = '503ba892e8482976b81eb2b2df292858fbac3782',
|
sha1 = 'b5802815625d82f39c33219299771f3d64301b06',
|
||||||
license = 'DO_NOT_DISTRIBUTE',
|
license = 'DO_NOT_DISTRIBUTE',
|
||||||
deps = [
|
deps = [
|
||||||
':guava',
|
':guava',
|
||||||
|
Loading…
Reference in New Issue
Block a user