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