package Ġcom . fa endir . card market . service Ċ Ċ import Ġcom . fa endir . card market . config . Card market Api Configuration Ċ import Ġcom . fa endir . card market . model .* Ċ import Ġcom . nat pr y ce . ham k rest .* Ċ import Ġcom . nat pr y ce . ham k rest . assertion . assertThat Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġorg . junit . jupiter . api . Test Instance Ċ Ċ /** Ċ Ġ* Ġ@ author Ġl uk as Ċ Ġ* Ġ@ since Ġ 1 5 . 1 0 . 1 9 Ċ Ġ*/ Ċ @ Test Instance ( Test Instance . Lifecycle . PER _ CLASS ) Ċ internal Ġclass ĠW ants List Service Test Ġ{ ĊĠĠĠ Ġprivate Ġval Ġconfig Ġ= ĠCard market Api Configuration . get () ĊĠĠĠ Ġprivate Ġval Ġservice Ġ= ĠW ants List Service ( config ) ĊĠĠĠ Ġprivate Ġval Ġmarket place Service Ġ= ĠMarketplace Service ( config ) ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġwants Lists Items () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġname Ġ= Ġ" Test W ants List " ĊĠĠĠĠĠĠĠ Ġservice . create W ants List ( Game . MT G , Ġname ) ĊĠĠĠĠĠĠĠ Ġval Ġwants Lists Ġ= Ġservice . get W ants Lists () ĊĠĠĠĠĠĠĠ ĠassertThat ( w ants Lists , Ġany Element ( has ( W ants List :: name , ĠequalTo ( name )))) ĊĠĠĠĠĠĠĠ Ġval Ġwants List Ġ= Ġwants Lists . find Ġ{ Ġit . name Ġ== Ġname Ġ} !! ĊĠĠĠĠĠĠĠ ĠassertThat ( w ants List . items , ĠisEmpty ) ĊĠĠĠĠĠĠĠ Ġval Ġproduct Ġ= Ġmarket place Service . find Product (" N exus Ġof ĠF ate ")[ 0 ] ĊĠĠĠĠĠĠĠ Ġval Ġmet apro duct Ġ= Ġmarket place Service . find Met apro duct s (" Cr uc ible Ġof ĠWorld s ")[ 0 ] ĊĠĠĠĠĠĠĠ Ġservice . add Items ( w ants List , Ġproduct . to Want (), Ġmet apro duct . to Want ()) ĊĠĠĠĠĠĠĠ ĠassertThat ( service . get W ants Lists (), Ġany Element ( has ( W ants List :: name , ĠequalTo ( name )) Ġand Ġhas ( W ants List :: items , ĠisEmpty ))) ĊĠĠĠĠĠĠĠ Ġval Ġitems Ġ= Ġservice . get W ants List ( w ants List ). items ĊĠĠĠĠĠĠĠ ĠassertThat ( items , Ġhas Size ( equalTo ( 2 ))) ĊĠĠĠĠĠĠĠ ĠassertThat ( items , Ġany Element ( is A ( has ( Product Want :: id Product , ĠequalTo ( product . id Product ))))) ĊĠĠĠĠĠĠĠ ĠassertThat ( items , Ġany Element ( is A ( has ( Met apro duct Want :: id Met apro duct , ĠequalTo ( met apro duct . id Met apro duct ))))) ĊĠĠĠĠĠĠĠ Ġservice . edit Item ( w ants List , Ġitems . filter Is Instance < Product Want >() [ 0 ]. copy ( count Ġ= Ġ 2 )) ĊĠĠĠĠĠĠĠ Ġservice . edit Item ( w ants List , Ġitems . filter Is Instance < Met apro duct Want >() [ 0 ]. copy ( is Fo il Ġ= Ġtrue )) ĊĠĠĠĠĠĠĠ ĠassertThat ( service . get W ants List ( w ants List ). items , Ġany Element ( is A ( has ( Product Want :: count , ĠequalTo ( 2 ))))) ĊĠĠĠĠĠĠĠ ĠassertThat ( service . get W ants List ( w ants List ). items , Ġany Element ( is A ( has ( Met apro duct Want :: is Fo il , ĠequalTo ( true ))))) ĊĠĠĠĠĠĠĠ Ġservice . delete Item ( w ants List , Ġservice . get W ants List ( w ants List ). items . filter Is Instance < Product Want >() [ 0 ]) ĊĠĠĠĠĠĠĠ ĠassertThat ( service . get W ants List ( w ants List ). items , Ġ! any Element ( is A ( has ( Product Want :: id Product , ĠequalTo ( product . id Product ))))) ĊĠĠĠĠĠĠĠ Ġservice . delete W ants List ( w ants List ) ĊĠĠĠĠĠĠĠ ĠassertThat ( service . get W ants Lists (), Ġ! any Element ( has ( W ants List :: name , ĠequalTo ( name )))) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġwants Lists Name () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġname Ġ= Ġ" Test W ants List Ġ 2 " ĊĠĠĠĠĠĠĠ Ġservice . create W ants List ( Game . MT G , Ġname ) ĊĠĠĠĠĠĠĠ Ġvar Ġwants Lists Ġ= Ġservice . get W ants Lists () ĊĠĠĠĠĠĠĠ ĠassertThat ( w ants Lists , Ġany Element ( has ( W ants List :: name , ĠequalTo ( name )))) ĊĠĠĠĠĠĠĠ Ġval Ġwants List Ġ= Ġwants Lists . find Ġ{ Ġit . name Ġ== Ġname Ġ} !! ĊĠĠĠĠĠĠĠ Ġval ĠnewName Ġ= Ġ" Test W ants List Ġ 3 " ĊĠĠĠĠĠĠĠ Ġservice . change Name ( w ants List , ĠnewName ) ĊĠĠĠĠĠĠĠ Ġwants Lists Ġ= Ġservice . get W ants Lists () ĊĠĠĠĠĠĠĠ ĠassertThat ( w ants Lists , Ġany Element ( has ( W ants List :: name , ĠequalTo ( new Name )))) ĊĠĠĠĠĠĠĠ ĠassertThat ( w ants Lists , Ġ! any Element ( has ( W ants List :: name , ĠequalTo ( name )))) ĊĠĠĠĠĠĠĠ Ġservice . delete W ants List ( w ants List ) ĊĠĠĠĠĠĠĠ Ġwants Lists Ġ= Ġservice . get W ants Lists () ĊĠĠĠĠĠĠĠ ĠassertThat ( w ants Lists , Ġ! any Element ( has ( W ants List :: name , ĠequalTo ( new Name )))) ĊĠĠĠĠĠĠĠ ĠassertThat ( w ants Lists , Ġ! any Element ( has ( W ants List :: name , ĠequalTo ( name )))) ĊĠĠĠ Ġ} Ċ }