public static FreeStyleProject createGerritTriggeredJob(JenkinsRule rule,
String projectName, String serverName) throws Exception {
FreeStyleProject p = rule.createFreeStyleProject(projectName);
List<GerritProject> projects = new LinkedList<GerritProject>();
projects.add(new GerritProject(CompareType.ANT, "**",
Collections.singletonList(new Branch(CompareType.ANT, "**")), null, null, null));
p.addTrigger(new GerritTrigger(projects, null,
null, null, null, null, null, null, null, null, null, null,
false, false, true, false, false, null, null, null, null, null, null, null,
null, serverName, null, null, false, false, null, null));
rule.submit(rule.createWebClient().getPage(p, "configure").getFormByName("config"));