### Question:
BuildTriggerPublisherConverter extends SingleTypedConverter<BuildTrigger> { @Override public boolean convert(ConverterRequest request, ConverterResult result, Object target) { BuildTrigger buildTrigger = (BuildTrigger) target; if (buildTrigger.getChildJobs((AbstractProject<?, ?>) request.getJob()) == null || buildTrigger.getChildJobs((AbstractProject<?, ?>) request.getJob()).isEmpty()) { return true; } ModelASTBuildCondition buildCondition = ModelASTUtils.buildOrFindBuildCondition( result.getModelASTPipelineDef(), "always" ); buildTrigger.getChildJobs((AbstractProject<?, ?>) request.getJob()).forEach( abstractProject -> { ModelASTBranch branch = buildCondition.getBranch(); if(branch==null){ branch =new ModelASTBranch( this ); buildCondition.setBranch( branch ); } ModelASTStep build = new ModelASTStep( this ){ @Override public String toGroovy() { return "build(job: '"+abstractProject.getName()+"')"; } }; build.setName( "build" ); branch.getSteps().add( build ); } ); return true; }  @Override boolean convert(ConverterRequest request, ConverterResult result, Object target);  }### Answer:
@Test public void simpletest() throws Exception { String projectName = Long.toString( System.currentTimeMillis() ); FreeStyleProject p = j.createFreeStyleProject( projectName ); j.createFreeStyleProject( "foo" ); j.createFreeStyleProject( "bar" ); j.createFreeStyleProject( "beer" ); BuildTrigger buildTrigger = new BuildTrigger( "foo,bar", Result.SUCCESS ); p.getPublishersList().add( buildTrigger ); BuildTriggerPublisherConverter converter = j.jenkins.getExtensionList( BuildTriggerPublisherConverter.class ).get( 0 ); assertTrue( converter.canConvert( buildTrigger ) ); ConverterResult result = new ConverterResult(); converter.convert( new ConverterRequest().job( p ), result, buildTrigger ); ModelASTPostBuild postBuild = result.getModelASTPipelineDef().getPostBuild(); assertEquals( 1, postBuild.getConditions().size() ); String groovy = postBuild.getConditions().get( 0 ).toGroovy(); assertThat( groovy, containsString( "build(job: 'foo')" ) ); assertThat( groovy, containsString( "build(job: 'bar')" ) ); assertThat( groovy, not(containsString( "build(job: 'beer')" ) )); }