package Ġcom . tester um . report _ generators . reports . json _ events Ċ Ċ import Ġcom . tester um . report _ generators . reports . utils . EXEC UTION _ LIST EN ERS _ OBJECT _ MAP PER Ċ import Ġcom . tester um . report _ generators . reports . utils . console _ output _ capture . Console Output Capt urer Ċ import Ġcom . tester um . report _ generators . reports . utils . string _ writer . Text Printer Ċ import Ġcom . tester um . report _ generators . reports . utils . string _ writer . impl . File Text Printer Ċ import Ġcom . tester um . runner . cmdline . report _ type . builder . EventListener Properties Ċ import Ġcom . tester um . runner . events . execution _ listener . Execution Listener Ċ import Ġcom . tester um . runner . events . model . Runner Event Ċ import Ġjava . nio . file . Paths Ċ Ċ class ĠJson Events Execution Listener ( private Ġval Ġproperties : ĠMap < String , ĠString >) Ġ: ĠExecution Listener Ġ{ ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġ// ĠIMPORT ANT : Ġif Ġyou Ġchange Ġthese , Ġalso Ġchange Ġit Ġin Ġcom . tester um . web _ backend . services . runner . execution . TestRunner Event Parser ĊĠĠĠĠĠĠĠ Ġprivate Ġconst Ġval ĠTEST ER UM _ EVENT _ PREFIX Ġ Ġ= Ġ" --> tester um \ u 0 0 0 0 --> " ĊĠĠĠĠĠĠĠ Ġprivate Ġconst Ġval ĠTEST ER UM _ EVENT _ POST FIX Ġ= Ġ"< -- tester um \ u 0 0 0 0 < -- " ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġval Ġtext Printer : ĠText Printer Ġ= Ġrun Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdestination FileName Ġ= Ġproperties [ EventListener Properties . Json Events . DEST INATION _ FILE _ NAME ] ĊĠĠĠĠĠĠĠ Ġif Ġ( destination FileName Ġ== Ġnull ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn @ run ĠConsole Output Capt urer . get Original Text Writer () ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn @ run ĠFile Text Printer ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPaths . get ( destination FileName ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġval Ġwrap Json With Prefix And Post fix : ĠBoolean Ġ= Ġrun Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġproperty Ġ= Ġproperties [ EventListener Properties . Json Events . WRAP _ JSON _ WITH _ PREFIX _ AND _ POST FIX ] ĊĊĠĠĠĠĠĠĠ Ġif Ġ( property Ġ== Ġnull ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfalse ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġproperty . to Boolean () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġstart () Ġ{} ĊĊĠĠĠ Ġoverride Ġfun Ġon Event ( event : ĠRunner Event ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġserialized Event Ġ= ĠEXEC UTION _ LIST EN ERS _ OBJECT _ MAP PER . writeValue AsString ( event ) ĊĊĠĠĠĠĠĠĠ Ġif Ġ( wrap Json With Prefix And Post fix ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtext Printer . print ("$ TEST ER UM _ EVENT _ PREFIX $ serialized Event $ TEST ER UM _ EVENT _ POST FIX \ n ") ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtext Printer . print ("$ serialized Event \ n ") ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġstop () Ġ{ ĊĠĠĠĠĠĠĠ Ġtext Printer . close () ĊĠĠĠ Ġ} Ċ Ċ } Ċ