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 Ċ import Ġorg . hamcrest . core . Is Ċ import Ġorg . junit . Test ĊĊ Ċ class ĠStatistics UtilsTest Ġ{ ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġget Active And Completed Stats _ no Completed _ returns H undred Zero () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtasks Ġ= ĠlistOf ( Task (" title ", Ġ" desc ", Ġis Completed Ġ= Ġfalse )) ĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġget Active And Completed Stats ( tasks ) ĊĊĠĠĠĠĠĠĠ ĠMatcher Assert . assertThat ( result . active Tasks Percent , ĠIs .` is `( 1 0 0 f )) ĊĠĠĠĠĠĠĠ ĠMatcher Assert . assertThat ( result . completed Tasks Percent , ĠIs .` is `( 0 f )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġget Active And Completed Stats _ no Active _ returns Zero H undred () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtasks Ġ= ĠlistOf ( Task (" title ", Ġ" desc ", Ġis Completed Ġ= Ġtrue )) ĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġget Active And Completed Stats ( tasks ) ĊĊĠĠĠĠĠĠĠ ĠMatcher Assert . assertThat ( result . active Tasks Percent , ĠIs .` is `( 0 f )) ĊĠĠĠĠĠĠĠ ĠMatcher Assert . assertThat ( result . completed Tasks Percent , ĠIs .` is `( 1 0 0 f )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġget Active And Completed Stats _ no Completed _ returns For Six ty () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtasks Ġ= ĠlistOf ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠTask ( title Ġ= Ġ" Title 1 ", Ġdescription Ġ= Ġ" Description 1 ", Ġis Completed Ġ= Ġtrue ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠTask ( title Ġ= Ġ" Title 2 ", Ġdescription Ġ= Ġ" Description 2 ", Ġis Completed Ġ= Ġfalse ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠTask ( title Ġ= Ġ" Title 3 ", Ġdescription Ġ= Ġ" Description 3 ", Ġis Completed Ġ= Ġfalse ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠTask ( title Ġ= Ġ" Title 4 ", Ġdescription Ġ= Ġ" Description 4 ", Ġis Completed Ġ= Ġtrue ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠTask ( title Ġ= Ġ" Title 5 ", Ġdescription Ġ= Ġ" Description 5 ", Ġis Completed Ġ= Ġtrue )) ĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġget Active And Completed Stats ( tasks ) ĊĊĠĠĠĠĠĠĠ ĠMatcher Assert . assertThat ( result . completed Tasks Percent , ĠIs .` is `( 6 0 F )) ĊĠĠĠĠĠĠĠ ĠMatcher Assert . assertThat ( result . active Tasks Percent , ĠIs .` is `( 4 0 F )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġget Active And Completed Stats _ empty _ returns Z eros () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtasks Ġ= Ġempty List < Task >() ĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġget Active And Completed Stats ( tasks ) ĊĊĠĠĠĠĠĠĠ ĠMatcher Assert . assertThat ( result . completed Tasks Percent , ĠIs .` is `( 0 F )) ĊĠĠĠĠĠĠĠ ĠMatcher Assert . assertThat ( result . active Tasks Percent , ĠIs .` is `( 0 F )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġget Active And Completed Stats _ empty _ returns Null () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtasks Ġ= Ġnull ĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġget Active And Completed Stats ( tasks ) ĊĊĠĠĠĠĠĠĠ ĠMatcher Assert . assertThat ( result . completed Tasks Percent , ĠIs .` is `( 0 F )) ĊĠĠĠĠĠĠĠ ĠMatcher Assert . assertThat ( result . active Tasks Percent , ĠIs .` is `( 0 F )) ĊĠĠĠ Ġ} Ċ }