HelloWorldBuilder extends Builder implements SimpleBuildStep { @DataBoundSetter public void setUseFrench(boolean useFrench) { this.useFrench = useFrench; } @DataBoundConstructor  HelloWorldBuilder(String name); String getName(); boolean isUseFrench(); @DataBoundSetter void setUseFrench(boolean useFrench); @Override void perform(Run<?, ?> run, FilePath workspace, Launcher launcher, TaskListener listener);  }
@Test public void testConfigRoundtripFrench() throws Exception { FreeStyleProject project = jenkins.createFreeStyleProject(); HelloWorldBuilder builder = new HelloWorldBuilder(name); builder.setUseFrench(true); project.getBuildersList().add(builder); project = jenkins.configRoundtrip(project); HelloWorldBuilder lhs = new HelloWorldBuilder(name); lhs.setUseFrench(true); jenkins.assertEqualDataBoundBeans(lhs, project.getBuildersList().get(0)); }
@Test public void testBuildFrench() throws Exception { FreeStyleProject project = jenkins.createFreeStyleProject(); HelloWorldBuilder builder = new HelloWorldBuilder(name); builder.setUseFrench(true); project.getBuildersList().add(builder); FreeStyleBuild build = jenkins.buildAndAssertSuccess(project); jenkins.assertLogContains("Bonjour, " + name, build); }