Skip to content
Permalink
Browse files

[JENKINS-40921] Add test to verify configuration page for triggers works

  • Loading branch information...
stephenc committed Mar 1, 2017
1 parent 9c378be commit e72a89e4964458ed51a9d0f7d30e8616c750ae95
Showing with 14 additions and 0 deletions.
  1. +14 −0 src/test/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolderTest.java
@@ -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;
@@ -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;
@@ -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> {

0 comments on commit e72a89e

Please sign in to comment.
You can’t perform that action at this time.