Skip to content

Commit

Permalink
[JENKINS-40921] Add test to verify configuration page for triggers works
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenc committed Mar 1, 2017
1 parent 9c378be commit e72a89e
Showing 1 changed file with 14 additions and 0 deletions.
Expand Up @@ -42,6 +42,7 @@
import hudson.model.TopLevelItem;
import hudson.model.View;
import hudson.model.ViewGroup;
import hudson.triggers.Trigger;
import hudson.views.DefaultViewsTabBar;
import hudson.views.ViewsTabBar;
import java.io.ByteArrayOutputStream;
Expand All @@ -59,6 +60,7 @@
import org.apache.commons.lang.StringUtils;
import org.junit.Test;

import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.notNullValue;
Expand Down Expand Up @@ -339,6 +341,18 @@ public void run() {
assertThat(org.round, is(round));
}

@Test
public void triggersRoundtrip() throws Exception {
SampleComputedFolder s = r.jenkins.createProject(SampleComputedFolder.class, "s");
s.addTrigger(new PeriodicFolderTrigger("30m"));
SampleComputedFolder s2 = r.configRoundtrip(s);
Trigger<?> trigger = s2.getTriggers().get(r.jenkins.getDescriptorByType(PeriodicFolderTrigger.DescriptorImpl.class));
assertThat(trigger, notNullValue());
assertThat(trigger, instanceOf(PeriodicFolderTrigger.class));
assertThat(((PeriodicFolderTrigger)trigger).getInterval(), is("30m"));

}

@SuppressWarnings({"unchecked", "rawtypes"})
public static class SampleComputedFolder extends ComputedFolder<FreeStyleProject> {

Expand Down

0 comments on commit e72a89e

Please sign in to comment.