@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);
    }
  }
 @Test
 public void byHashtagWithoutNotedb() throws Exception {
   assume().that(notesMigration.enabled()).isFalse();
   setUpHashtagChanges();
   assertQuery("hashtag:foo");
   assertQuery("hashtag:bar");
   assertQuery("hashtag:\" bar \"");
   assertQuery("hashtag:\"a tag\"");
   assertQuery("hashtag:\" a tag \"");
   assertQuery("hashtag:#foo");
   assertQuery("hashtag:\"# #foo\"");
 }
 @Test
 public void byHashtagWithNotedb() throws Exception {
   assume().that(notesMigration.enabled()).isTrue();
   List<Change> changes = setUpHashtagChanges();
   assertQuery("hashtag:foo", changes.get(1), changes.get(0));
   assertQuery("hashtag:bar", changes.get(1));
   assertQuery("hashtag:\"a tag\"", changes.get(1));
   assertQuery("hashtag:\"a tag \"", changes.get(1));
   assertQuery("hashtag:\" a tag \"", changes.get(1));
   assertQuery("hashtag:\"#a tag\"", changes.get(1));
   assertQuery("hashtag:\"# #a tag\"", changes.get(1));
 }
 @ConfigSuite.Config
 public static Config noteDbEnabled() {
   return updateConfig(NotesMigration.allEnabledConfig());
 }