private SoapFault constructControlFault ( TestContext context ) { SoapFault controlFault = new SoapFault ( ) ; if ( StringUtils . hasText ( faultActor ) ) { controlFault . faultActor ( context . replaceDynamicContentInString ( faultActor ) ) ; } controlFault . faultCode ( context . replaceDynamicContentInString ( faultCode ) ) ; controlFault . faultString ( context . replaceDynamicContentInString ( faultString ) ) ; for ( String faultDetail : faultDetails ) { controlFault . addFaultDetail ( context . replaceDynamicContentInString ( faultDetail ) ) ; } try { for ( String faultDetailPath : faultDetailResourcePaths ) { String resourcePath = context . replaceDynamicContentInString ( faultDetailPath ) ; controlFault . addFaultDetail ( context . replaceDynamicContentInString ( FileUtils . readToString ( FileUtils . getFileResource ( resourcePath , context ) , FileUtils . getCharset ( resourcePath ) ) ) ) ; } } catch ( IOException e ) { throw new CitrusRuntimeException ( "Failed to create SOAP fault detail from file resource" , e ) ; } return controlFault ; }
Constructs the control soap fault holding all expected fault information like faultCode faultString and faultDetail .