AbstractIndexTests#assertQuery: Rename to assertChangeQuery
Rename the method to disambiguate from account and group query methods that will potentially be added. Also add missing braces around if-else blocks. Change-Id: I03efbd1fc242887d8056cc066736d1c0bbba7a5e
This commit is contained in:
@@ -45,20 +45,24 @@ public abstract class AbstractIndexTests extends AbstractDaemonTest {
|
|||||||
disableChangeIndexWrites();
|
disableChangeIndexWrites();
|
||||||
amendChange(changeId, "second test", "test2.txt", "test2");
|
amendChange(changeId, "second test", "test2.txt", "test2");
|
||||||
|
|
||||||
assertQuery("message:second", change.getChange(), false);
|
assertChangeQuery("message:second", change.getChange(), false);
|
||||||
enableChangeIndexWrites();
|
enableChangeIndexWrites();
|
||||||
|
|
||||||
String cmd = Joiner.on(" ").join("gerrit", "index", "changes", changeLegacyId);
|
String cmd = Joiner.on(" ").join("gerrit", "index", "changes", changeLegacyId);
|
||||||
adminSshSession.exec(cmd);
|
adminSshSession.exec(cmd);
|
||||||
|
|
||||||
assertQuery("message:second", change.getChange(), true);
|
assertChangeQuery("message:second", change.getChange(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void assertQuery(String q, ChangeData change, Boolean assertTrue) throws Exception {
|
protected void assertChangeQuery(String q, ChangeData change, Boolean assertTrue)
|
||||||
|
throws Exception {
|
||||||
List<ChangeInfo> result = query(q);
|
List<ChangeInfo> result = query(q);
|
||||||
Iterable<Integer> ids = ids(result);
|
Iterable<Integer> ids = ids(result);
|
||||||
if (assertTrue) assertThat(ids).contains(change.getId().get());
|
if (assertTrue) {
|
||||||
else assertThat(ids).doesNotContain(change.getId().get());
|
assertThat(ids).contains(change.getId().get());
|
||||||
|
} else {
|
||||||
|
assertThat(ids).doesNotContain(change.getId().get());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static Iterable<Integer> ids(Iterable<ChangeInfo> changes) {
|
protected static Iterable<Integer> ids(Iterable<ChangeInfo> changes) {
|
||||||
|
|||||||
Reference in New Issue
Block a user