### Question:
BuildTimeoutWrapperConverter extends SingleTypedConverter<BuildTimeoutWrapper> { @Override public boolean convert(ConverterRequest request, ConverterResult result, Object target) { BuildTimeoutWrapper timeoutWrapper = (BuildTimeoutWrapper)target; BuildTimeOutStrategy strategy = timeoutWrapper.getStrategy(); if(!(strategy instanceof AbsoluteTimeOutStrategy)){ result.addWarning( new Warning( "we can only convert Absolute timeout and not " + strategy.getDescriptor().getDisplayName(), BuildTimeOutStrategy.class )); return false; } ModelASTOption timeout = new ModelASTOption( this ); timeout.setName( "timeout" ); List<ModelASTMethodArg> timeoutArgs = new ArrayList<>(); AbsoluteTimeOutStrategy absoluteTimeOutStrategy = (( AbsoluteTimeOutStrategy)strategy); timeoutArgs.add( buildKeyPairArg("time", Long.parseLong( absoluteTimeOutStrategy.getTimeoutMinutes()))); timeoutArgs.add( buildKeyPairArg("unit", "MINUTES")); timeout.setArgs( timeoutArgs ); ModelASTPipelineDef modelASTPipelineDef = result.getModelASTPipelineDef(); if(modelASTPipelineDef.getOptions() == null) { modelASTPipelineDef.setOptions( new ModelASTOptions( this ) ); } ModelASTUtils.addOption(modelASTPipelineDef, timeout); return true; }  @Override boolean convert(ConverterRequest request, ConverterResult result, Object target);  }### Answer:
@Test public void simpletest() throws Exception { ExtensionList<BaseConverter> allConverters = SingleTypedConverter.all(); ExtensionList<BuildTimeoutWrapperConverter> btwList = j.jenkins.getExtensionList(BuildTimeoutWrapperConverter.class); BuildTimeoutWrapperConverter converter = j.jenkins.getExtensionList( BuildTimeoutWrapperConverter.class ).get( 0 ); BuildTimeoutWrapper wrapper = new BuildTimeoutWrapper( new AbsoluteTimeOutStrategy( "180" ), Collections.singletonList( new FailOperation() ), "FOO" ); ConverterResult result = new ConverterResult(); converter.convert( new ConverterRequest(), result, wrapper ); ModelASTOptions options = result.getModelASTPipelineDef().getOptions(); assertEquals( 1, options.getOptions().size() ); ModelASTOption option = options.getOptions().get( 0 ); assertEquals( "timeout", option.getName() ); String groovy = option.toGroovy(); assertThat( groovy, containsString( "time: 180" ) ); assertThat( groovy, containsString( "unit: 'MINUTES'" ) ); }