### Question:
SCMTriggerConverter extends SingleTypedConverter<SCMTrigger> { @Override public boolean convert(ConverterRequest request, ConverterResult result, Object target) { SCMTrigger scmTrigger = (SCMTrigger) target; String cronValue = scmTrigger.getSpec(); ModelASTTrigger modelASTTrigger = new ModelASTTrigger( this ); modelASTTrigger.setName( "pollSCM" ); modelASTTrigger.setArgs( Arrays.asList(ModelASTValue.fromConstant( cronValue, this )) ); ModelASTUtils.addTrigger( result.getModelASTPipelineDef(), modelASTTrigger ); 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 ); SCMTrigger trigger = new SCMTrigger( "H */4 * * 1-5" ); p.addTrigger( trigger ); SCMTriggerConverter converter = j.jenkins .getExtensionList( SCMTriggerConverter.class ).get( 0 ); assertTrue(converter.canConvert( trigger ) ); ConverterResult result = new ConverterResult(); converter.convert( new ConverterRequest().job( p ), result, trigger ); List<ModelASTTrigger> triggers = result.getModelASTPipelineDef().getTriggers().getTriggers(); assertEquals( 1, triggers.size() ); String groovy = result.getModelASTPipelineDef().getTriggers().toGroovy(); System.out.println( groovy ); assertThat( groovy, containsString( "pollSCM" ) ); assertThat( groovy, containsString( "H */4 * * 1-5" ) ); }