package Ġcom . example . android . architecture . blueprint s . todo app . statistics Ċ Ċ import Ġcom . example . android . architecture . blueprint s . todo app . data . Task Ċ import Ġorg . hamcrest . Matcher Assert . assertThat Ċ import Ġorg . junit . Test Ċ import Ġorg . hamcrest . Matchers .` is ` Ċ Ċ class ĠStatistics UtilsTest Ġ{ ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` get Ġactive Ġand Ġcompleted Ġstats Ġwith Ġzero Ġcompletion `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtasks Ġ= ĠlistOf ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTask (" Hello ", Ġ" world ", Ġfalse ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġget Active And Completed Stats ( tasks ) ĊĠĠĠĠĠĠĠ ĠassertThat ( result . active Tasks Percent , Ġ` is `( 1 0 0 f )) ĊĠĠĠĠĠĠĠ ĠassertThat ( result . completed Tasks Percent , Ġ` is `( 0 f )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġget Active And Completed Stats _ no Active _ returns Zero H undred () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtasks Ġ= ĠlistOf ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTask (" H ", Ġ" W ", Ġtrue ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġval Ġres Ġ= Ġget Active And Completed Stats ( tasks ) ĊĠĠĠĠĠĠĠ ĠassertThat ( res . active Tasks Percent , Ġ` is `( 0 f )) ĊĠĠĠĠĠĠĠ ĠassertThat ( res . completed Tasks Percent , Ġ` is `( 1 0 0 f )) ĊĠĠĠ Ġ} ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġget Active And Completed Stats _ Three Active Two Completed _ returns Zero H undred () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtasks Ġ= ĠlistOf ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTask (" H ", Ġ" W ", Ġtrue ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTask (" H ", Ġ" W ", Ġtrue ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTask (" H ", Ġ" W ", Ġfalse ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTask (" H ", Ġ" W ", Ġfalse ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTask (" H ", Ġ" W ", Ġfalse ), ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġval Ġres Ġ= Ġget Active And Completed Stats ( tasks ) ĊĠĠĠĠĠĠĠ ĠassertThat ( res . active Tasks Percent , Ġ` is `( 6 0 f )) ĊĠĠĠĠĠĠĠ ĠassertThat ( res . completed Tasks Percent , Ġ` is `( 4 0 f )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġget Active And Completed Stats _ empty Tasks _ returns Zero Zero () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġget Active And Completed Stats ( emptyList ()) ĊĠĠĠĠĠĠĠ ĠassertThat ( result . active Tasks Percent , Ġ` is `( 0 f )) ĊĠĠĠĠĠĠĠ ĠassertThat ( result . completed Tasks Percent , Ġ` is `( 0 f )) ĊĠĠĠ Ġ} Ċ }