Use simpler isTrue() and isFalse() in tests

Change-Id: Ib77acebcafcd4ba89b345d2f3ff1a4a98191329a
This commit is contained in:
Changcheng Xiao
2018-01-10 17:10:49 +01:00
committed by David Pursehouse
parent 2d2968ea06
commit 7bcf5b715d
5 changed files with 13 additions and 15 deletions

View File

@@ -47,7 +47,7 @@ public class DisablePrivateChangesIT extends AbstractDaemonTest {
public void createPrivateChangeWithDisablePrivateChangesFalse() throws Exception { public void createPrivateChangeWithDisablePrivateChangesFalse() throws Exception {
ChangeInput input = new ChangeInput(project.get(), "master", "empty change"); ChangeInput input = new ChangeInput(project.get(), "master", "empty change");
input.isPrivate = true; input.isPrivate = true;
assertThat(gApi.changes().create(input).get().isPrivate).isEqualTo(true); assertThat(gApi.changes().create(input).get().isPrivate).isTrue();
} }
@Test @Test
@@ -84,7 +84,7 @@ public class DisablePrivateChangesIT extends AbstractDaemonTest {
public void pushPrivatesWithDisablePrivateChangesFalse() throws Exception { public void pushPrivatesWithDisablePrivateChangesFalse() throws Exception {
PushOneCommit.Result result = PushOneCommit.Result result =
pushFactory.create(db, admin.getIdent(), testRepo).to("refs/for/master%private"); pushFactory.create(db, admin.getIdent(), testRepo).to("refs/for/master%private");
assertThat(result.getChange().change().isPrivate()).isEqualTo(true); assertThat(result.getChange().change().isPrivate()).isTrue();
} }
@Test @Test
@@ -92,11 +92,11 @@ public class DisablePrivateChangesIT extends AbstractDaemonTest {
RevCommit initialHead = getRemoteHead(); RevCommit initialHead = getRemoteHead();
PushOneCommit.Result result = PushOneCommit.Result result =
pushFactory.create(db, admin.getIdent(), testRepo).to("refs/for/master%draft"); pushFactory.create(db, admin.getIdent(), testRepo).to("refs/for/master%draft");
assertThat(result.getChange().change().isPrivate()).isEqualTo(true); assertThat(result.getChange().change().isPrivate()).isTrue();
testRepo.reset(initialHead); testRepo.reset(initialHead);
result = pushFactory.create(db, admin.getIdent(), testRepo).to("refs/drafts/master"); result = pushFactory.create(db, admin.getIdent(), testRepo).to("refs/drafts/master");
assertThat(result.getChange().change().isPrivate()).isEqualTo(true); assertThat(result.getChange().change().isPrivate()).isTrue();
} }
@Test @Test

View File

@@ -1923,8 +1923,8 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
assertThat(info1.status).isEqualTo(ChangeStatus.NEW); assertThat(info1.status).isEqualTo(ChangeStatus.NEW);
assertThat(info2.status).isEqualTo(ChangeStatus.NEW); assertThat(info2.status).isEqualTo(ChangeStatus.NEW);
assertThat(info1.isPrivate).isEqualTo(true); assertThat(info1.isPrivate).isTrue();
assertThat(info2.isPrivate).isEqualTo(true); assertThat(info2.isPrivate).isTrue();
assertThat(info1.revisions).hasSize(1); assertThat(info1.revisions).hasSize(1);
assertThat(info2.revisions).hasSize(1); assertThat(info2.revisions).hasSize(1);
} }

View File

@@ -1159,9 +1159,7 @@ public abstract class AbstractSubmit extends AbstractDaemonTest {
} }
protected void assertSubmittable(String changeId) throws Exception { protected void assertSubmittable(String changeId) throws Exception {
assertThat(get(changeId, SUBMITTABLE).submittable) assertThat(get(changeId, SUBMITTABLE).submittable).named("submit bit on ChangeInfo").isTrue();
.named("submit bit on ChangeInfo")
.isEqualTo(true);
RevisionResource rsrc = parseCurrentRevisionResource(changeId); RevisionResource rsrc = parseCurrentRevisionResource(changeId);
UiAction.Description desc = submitHandler.getDescription(rsrc); UiAction.Description desc = submitHandler.getDescription(rsrc);
assertThat(desc.isVisible()).named("visible bit on submit action").isTrue(); assertThat(desc.isVisible()).named("visible bit on submit action").isTrue();

View File

@@ -46,7 +46,7 @@ public class PrivateByDefaultIT extends AbstractDaemonTest {
public void createChangeWithPrivateByDefaultEnabled() throws Exception { public void createChangeWithPrivateByDefaultEnabled() throws Exception {
setPrivateByDefault(project2, InheritableBoolean.TRUE); setPrivateByDefault(project2, InheritableBoolean.TRUE);
ChangeInput input = new ChangeInput(project2.get(), "master", "empty change"); ChangeInput input = new ChangeInput(project2.get(), "master", "empty change");
assertThat(gApi.changes().create(input).get().isPrivate).isEqualTo(true); assertThat(gApi.changes().create(input).get().isPrivate).isTrue();
} }
@Test @Test
@@ -86,7 +86,7 @@ public class PrivateByDefaultIT extends AbstractDaemonTest {
@Test @Test
public void pushWithPrivateByDefaultEnabled() throws Exception { public void pushWithPrivateByDefaultEnabled() throws Exception {
setPrivateByDefault(project2, InheritableBoolean.TRUE); setPrivateByDefault(project2, InheritableBoolean.TRUE);
assertThat(createChange(project2).getChange().change().isPrivate()).isEqualTo(true); assertThat(createChange(project2).getChange().change().isPrivate()).isTrue();
} }
@Test @Test
@@ -97,18 +97,18 @@ public class PrivateByDefaultIT extends AbstractDaemonTest {
.getChange() .getChange()
.change() .change()
.isPrivate()) .isPrivate())
.isEqualTo(false); .isFalse();
} }
@Test @Test
public void pushWithPrivateByDefaultDisabled() throws Exception { public void pushWithPrivateByDefaultDisabled() throws Exception {
assertThat(createChange(project2).getChange().change().isPrivate()).isEqualTo(false); assertThat(createChange(project2).getChange().change().isPrivate()).isFalse();
} }
@Test @Test
public void pushBypassPrivateByDefaultInherited() throws Exception { public void pushBypassPrivateByDefaultInherited() throws Exception {
setPrivateByDefault(project1, InheritableBoolean.TRUE); setPrivateByDefault(project1, InheritableBoolean.TRUE);
assertThat(createChange(project2).getChange().change().isPrivate()).isEqualTo(true); assertThat(createChange(project2).getChange().change().isPrivate()).isTrue();
} }
@Test @Test

View File

@@ -1195,7 +1195,7 @@ public class ChangeRebuilderIT extends AbstractDaemonTest {
Map<String, List<CommentInfo>> comments = gApi.changes().id(id.get()).current().drafts(); Map<String, List<CommentInfo>> comments = gApi.changes().id(id.get()).current().drafts();
for (List<CommentInfo> cList : comments.values()) { for (List<CommentInfo> cList : comments.values()) {
for (CommentInfo ci : cList) { for (CommentInfo ci : cList) {
assertThat(ci.unresolved).isEqualTo(true); assertThat(ci.unresolved).isTrue();
} }
} }
} }