Search in sources :

Example 6 with StoredCommentLinkInfo

use of com.google.gerrit.entities.StoredCommentLinkInfo in project gerrit by GerritCodeReview.

the class StoredCommentLinkInfoSerializerTest method overrideOnly_roundTrip.

@Test
public void overrideOnly_roundTrip() {
    StoredCommentLinkInfo autoValue = StoredCommentLinkInfo.builder("name").setEnabled(true).setOverrideOnly(true).setLink("<p>html").setMatch("*").build();
    assertThat(deserialize(serialize(autoValue))).isEqualTo(autoValue);
}
Also used : StoredCommentLinkInfo(com.google.gerrit.entities.StoredCommentLinkInfo) Test(org.junit.Test)

Example 7 with StoredCommentLinkInfo

use of com.google.gerrit.entities.StoredCommentLinkInfo in project gerrit by GerritCodeReview.

the class ProjectConfigTest method readCommentLinksNoHtmlOrLinkAndMissingEnabled.

@Test
public void readCommentLinksNoHtmlOrLinkAndMissingEnabled() throws Exception {
    RevCommit rev = tr.commit().add("project.config", "[commentlink \"bugzilla\"]\n \tlink = http://bugs.example.com/show_bug.cgi?id=$2" + "\n \tmatch = \"(bug\\\\s+#?)(\\\\d+)\"\n").create();
    ProjectConfig cfg = read(rev);
    assertThat(cfg.getCommentLinkSections()).containsExactly(StoredCommentLinkInfo.builder("bugzilla").setMatch("(bug\\s+#?)(\\d+)").setLink("http://bugs.example.com/show_bug.cgi?id=$2").build());
    StoredCommentLinkInfo stored = Iterables.getOnlyElement(cfg.getCommentLinkSections());
    assertThat(StoredCommentLinkInfo.fromInfo(stored.toInfo(), stored.getEnabled())).isEqualTo(stored);
}
Also used : StoredCommentLinkInfo(com.google.gerrit.entities.StoredCommentLinkInfo) RevCommit(org.eclipse.jgit.revwalk.RevCommit) Test(org.junit.Test)

Aggregations

StoredCommentLinkInfo (com.google.gerrit.entities.StoredCommentLinkInfo)7 Test (org.junit.Test)5 CommentLinkInfo (com.google.gerrit.extensions.api.projects.CommentLinkInfo)2 RevCommit (org.eclipse.jgit.revwalk.RevCommit)2 ImmutableList (com.google.common.collect.ImmutableList)1 LinkedHashMap (java.util.LinkedHashMap)1