public T headerFragment ( Object model , String mapperName ) { Assert . notNull ( applicationContext , "Citrus application context is not initialized!" ) ; if ( applicationContext . containsBean ( mapperName ) ) { Object mapper = applicationContext . getBean ( mapperName ) ; if ( Marshaller . class . isAssignableFrom ( mapper . getClass ( ) ) ) { return headerFragment ( model , ( Marshaller ) mapper ) ; } else if ( ObjectMapper . class . isAssignableFrom ( mapper . getClass ( ) ) ) { return headerFragment ( model , ( ObjectMapper ) mapper ) ; } else { throw new CitrusRuntimeException ( String . format ( "Invalid bean type for mapper '%s' expected ObjectMapper or Marshaller but was '%s'" , mapperName , mapper . getClass ( ) ) ) ; } } throw new CitrusRuntimeException ( "Unable to find default object mapper or marshaller in application context" ) ; }
Expect this message header data as model object which is marshalled to a character sequence using the given object to xml mapper that is accessed by its bean name in Spring bean application context .