package Ġcom . jetbrains . edu . course creator . check io Ċ Ċ import Ġcom . intellij . openapi . file Types . Plain Text FileType Ċ import Ġcom . jetbrains . edu . learning .* Ċ import Ġcom . jetbrains . edu . learning . check io . Check i OC ourse Content Generator Ċ import Ġcom . jetbrains . edu . learning . check io . course Format . Check i OC ourse Ċ import Ġcom . jetbrains . edu . learning . check io . course Format . Check i OM ission Ċ import Ġcom . jetbrains . edu . learning . course Format . Check Status Ċ import Ġcom . jetbrains . edu . learning . messages . E du Core Bundle Ċ Ċ class ĠCheck i OC ourse Generation Test Ġ: ĠE du TestCase () Ġ{ ĊĠ Ġprivate Ġval Ġcontent Generator ĊĠĠĠ Ġget () Ġ= ĠCheck i OC ourse Content Generator ( Plain Text FileType . INSTANCE , ĠMock Check i O Api Connector ) ĊĊĠ Ġprivate Ġval Ġmock Connector : ĠMock Check i O Api Connector ĊĠĠĠ Ġget () Ġ= ĠMock Check i O Api Connector ĊĊĠ Ġoverride Ġfun ĠsetUp () Ġ{ ĊĠĠĠ Ġsuper . setUp () ĊĠĠĠ Ġconfigure Response () ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġconfigure Response () Ġ{ ĊĠĠĠ Ġmock Connector . with Response Handler ( test Root Disposable ) Ġ{ ĊĠĠĠĠĠ ĠMock Response Factory . from File ( getTest File (" missions . json ")) ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġfun Ġ` test Ġdeserialized Ġmission s Ġlist Ġhas Ġcorrect Ġsize `() Ġ{ ĊĠĠĠ ĠassertEquals ( 6 , Ġget Source Mission s (). size ) ĊĠ Ġ} ĊĊĠ Ġfun Ġ` test Ġorder Ġof Ġmission s `() Ġ{ ĊĠĠĠ Ġval Ġsource Mission s Ġ= Ġget Source Mission s () ĊĠĠĠ Ġval Ġprocessed Mission s Ġ= Ġget Processed Mission s () ĊĠĠĠ ĠassertEquals ( source Mission s . size , Ġprocessed Mission s . size ) ĊĊĠĠĠ Ġfor Ġ(( source , Ġprocessed ) Ġin Ġsource Mission s . zip ( processed Mission s )) Ġ{ ĊĠĠĠĠĠ ĠassertEquals ( source . name , Ġprocessed . name ) ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġfun Ġ` test Ġlinks Ġto Ġtask Ġand Ġsolutions Ġgenerated Ġcorrectly `() Ġ{ ĊĠĠĠ Ġval Ġmission s Ġ= Ġget Processed Mission s () ĊĊĠĠĠ Ġval Ġsolved Ġ= Ġmission s . first Ġ{ Ġit . status Ġ== ĠCheck Status . S olved Ġ} ĊĠĠĠ Ġval Ġactual Description Text Ġ= Ġsolved . description Text ĊĊĠĠĠ ĠassertTrue ( actual Description Text . contains ("< h 2 > St ress ful ĠSubject </ h 2 > ")) ĊĠĠĠ ĠassertTrue ( actual Description Text . contains ( E du Core Bundle . message (" check io . view . solutions "))) ĊĠĠĠ ĠassertTrue ( actual Description Text . contains ( E du Core Bundle . message (" check io . open . task . on . site "))) ĊĊĠĠĠ Ġ// ĠWe Ġshould Ġnot Ġhave Ġlink Ġto Ġother Ġsolutions Ġif Ġthe Ġtask Ġwas Ġnot Ġsolved ĊĠĠĠ Ġval Ġnot S olved Ġ= Ġmission s . filter Ġ{ Ġit . status Ġ!= ĠCheck Status . S olved Ġ&& Ġit . description Text . contains (" View Ġother Ġsolutions ") Ġ} ĊĠĠĠ Ġassert Empty ( not S olved ) ĊĠ Ġ} ĊĊĠ Ġfun Ġ` test Ġstation Ġand Ġmission Ġnames Ġare Ġcomputed Ġcorrectly `() Ġ{ ĊĠĠĠ Ġval Ġcheck i OC ourse Ġ= Ġcourse ( course Producer Ġ= Ġ:: Check i OC ourse ) Ġ{} Ġas ĠCheck i OC ourse ĊĠĠĠ Ġval Ġstations Ġ= Ġcontent Generator . get St ations From Server () ĊĠĠĠ Ġstations . forEach Ġ{ Ġcheck i OC ourse . add Station ( it ) Ġ} ĊĠĠĠ Ġcheck i OC ourse . create Course Files ( project , Ġmodule ) ĊĊĠĠĠ Ġfun ĠFile Tree Builder . dir WithDefault Files ( dir Name : ĠString ) Ġ{ ĊĠĠĠĠĠ Ġdir ( dir Name ) Ġ{ ĊĠĠĠĠĠĠĠ Ġfile (" task . html ") ĊĠĠĠĠĠĠĠ Ġfile (" mission . txt ") ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġcheck File Tree Ġ{ ĊĠĠĠĠĠ Ġdir (" Home ") Ġ{ ĊĠĠĠĠĠĠĠ Ġdir WithDefault Files (" All Ġthe ĠSame ") ĊĠĠĠĠĠĠĠ Ġdir WithDefault Files (" The ĠWar ri ors ") ĊĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġdir (" Send Grid ") Ġ{ ĊĠĠĠĠĠĠĠ Ġdir WithDefault Files (" St ress ful ĠSubject ") ĊĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġdir (" Element ary ") Ġ{ ĊĠĠĠĠĠĠĠ Ġdir WithDefault Files (" Multiply Ġ( Intro )") ĊĠĠĠĠĠĠĠ Ġdir WithDefault Files (" Say ĠHi ") ĊĠĠĠĠĠĠĠ Ġdir WithDefault Files (" Easy ĠUn pack ") ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġget Source Mission s () Ġ= ĠMock Check i O Api Connector . get Mission List () ĊĊĠ Ġprivate Ġfun Ġget Processed Mission s (): ĠList < Check i OM ission > Ġ{ ĊĠĠĠ Ġval Ġstations Ġ= Ġcontent Generator . get St ations From Server () ĊĠĠĠ Ġreturn Ġstations . flatMap Ġ{ Ġit . missions Ġ} ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġget TestData Path (): ĠString Ġ{ ĊĠĠĠ Ġreturn Ġsuper . get TestData Path () Ġ+ Ġ"/ check io /" ĊĠ Ġ} Ċ }