package Ġcom . github . ch ristop h pick l . der ba uer . upgrade Ċ Ċ import Ġcom . github . ch ristop h pick l . der ba uer . Test Model Listener Ċ import Ġcom . github . ch ristop h pick l . der ba uer . model . Model Ċ import Ġcom . github . ch ristop h pick l . der ba uer . model . amount . Amount Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . testng . annotations . Listeners Ċ import Ġorg . testng . annotations . Test Ċ Ċ @ Test Ċ @ Listeners ( Test Model Listener :: class ) Ċ class ĠUpgrade Test Ġ{ ĊĊĠĠĠ Ġfun Ġ` Given Ġnot Ġreally Ġenough Ġgold ĠWhen Ġupgrade ĠThen Ġsucceed Ġbecause Ġrounded Ġprice Ġused `() Ġ{ ĊĠĠĠĠĠĠĠ Ġupgrade . buy Price Ġ= ĠAmount ( 1 _ 9 9 9 ) ĊĠĠĠĠĠĠĠ ĠModel . gold Ġ= ĠAmount ( 1 _ 9 9 0 ) ĊĊĠĠĠĠĠĠĠ Ġdo Upgrade ( upgrade ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( upgrade . current Level ). isEqualTo ( 1 ) ĊĠĠĠĠĠĠĠ ĠassertThat ( Model . gold . real ). isEqualTo ( 0 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġ` Given Ġa Ġbit Ġmore Ġgold Ġthan Ġneeded ĠWhen Ġupgrade ĠThen Ġsome Ġgold Ġleft Ġbecause Ġrounded Ġprice Ġis Ġused `() Ġ{ ĊĠĠĠĠĠĠĠ Ġupgrade . buy Price Ġ= ĠAmount ( 1 _ 0 1 0 ) ĊĠĠĠĠĠĠĠ ĠModel . gold Ġ= ĠAmount ( 1 _ 0 1 7 ) ĊĊĠĠĠĠĠĠĠ Ġdo Upgrade ( upgrade ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( upgrade . current Level ). isEqualTo ( 1 ) ĊĠĠĠĠĠĠĠ ĠassertThat ( Model . gold . real ). isEqualTo ( 7 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġval Ġupgrade Ġget () Ġ= ĠModel . player . upgrade s . farm Product ivity ĊĊĠĠĠ Ġprivate Ġfun Ġdo Upgrade ( upgrade : ĠUpgrade ) Ġ{ ĊĠĠĠĠĠĠĠ ĠUpgrade Controller (). do Upgrade ( upgrade ) ĊĠĠĠ Ġ} Ċ Ċ } Ċ