### Question:
BatchFileConverter extends SingleTypedConverter<BatchFile> { @Override public boolean convert(ConverterRequest request, ConverterResult result, Object target) { BatchFile batchFile = (BatchFile) target; ModelASTStage stage = new ModelASTStage( this ); int stageNumber = request.getAndIncrement( BATCH_NUMBER_KEY ); stage.setName( "Batch script " + stageNumber ); ModelASTBranch branch = new ModelASTBranch( this ); stage.setBranches( Arrays.asList( branch ) ); ModelASTStep step = new ModelASTStep( this ); ModelASTSingleArgument singleArgument = new ModelASTSingleArgument( this ); singleArgument.setValue( ModelASTValue.fromConstant( batchFile.getCommand(), this ) ); step.setArgs( singleArgument ); step.setName( "bat" ); ModelASTUtils.wrapBranch(result, step, branch); ModelASTUtils.addStage(result.getModelASTPipelineDef() ,stage); return true; }  @Override boolean convert(ConverterRequest request, ConverterResult result, Object target); static final String BATCH_NUMBER_KEY; }### Answer:
@Test public void simpletest() throws Exception { BatchFileConverter converter = j.jenkins.getExtensionList( BatchFileConverter.class ).get( 0 ); BatchFile batchFile = new BatchFile( "cmd" ); ConverterResult result = new ConverterResult(); assertTrue( converter.canConvert( batchFile ) ); assertTrue(converter.convert( new ConverterRequest(), result, batchFile )); List<ModelASTStage> stages = result.getModelASTPipelineDef().getStages().getStages(); assertNotNull( stages ); String stageGroovy = stages.get(0).toGroovy(); assertThat( stageGroovy, CoreMatchers.containsString( "bat 'cmd'" ) ); }