@Test public void prepopulatedFields() throws Exception { assume().that(notesMigration.enabled()).isFalse(); TestRepository<Repo> repo = createProject("repo"); Change change = newChange(repo, null, null, null, null).insert(); db = new DisabledReviewDb(); requestContext.setContext(newRequestContext(userId)); // Use QueryProcessor directly instead of API so we get ChangeDatas back. List<ChangeData> cds = queryProcessor.queryChanges(queryBuilder.parse(change.getId().toString())).changes(); assertThat(cds).hasSize(1); ChangeData cd = cds.get(0); cd.change(); cd.patchSets(); cd.currentApprovals(); cd.changedLines(); cd.reviewedBy(); // TODO(dborowitz): Swap out GitRepositoryManager somehow? Will probably be // necessary for notedb anyway. cd.isMergeable(); // Don't use ExpectedException since that wouldn't distinguish between // failures here and on the previous calls. try { cd.messages(); } catch (AssertionError e) { assertThat(e.getMessage()).isEqualTo(DisabledReviewDb.MESSAGE); } }
@Override public boolean match(ChangeData cd) throws OrmException { return cd.change().getLastUpdatedOn().getTime() >= cut.getTime(); }
@Override public boolean match(final ChangeData object) throws OrmException { Change change = object.change(); return change != null && change.getLastUpdatedOn().getTime() <= cut; }