package Ġap pt ent ive . com . android . feedback . eng agement . criteria Ċ Ċ import Ġap pt ent ive . com . android . TestCase Ċ import Ġap pt ent ive . com . android . feedback . eng agement . Event Ċ import Ġap pt ent ive . com . android . feedback . eng agement . criteria . Field . application Ċ import Ġap pt ent ive . com . android . feedback . eng agement . criteria . Field . code _ point Ċ import Ġap pt ent ive . com . android . feedback . eng agement . criteria . Field . current _ time Ċ import Ġap pt ent ive . com . android . feedback . eng agement . criteria . Field . device Ċ import Ġap pt ent ive . com . android . feedback . eng agement . criteria . Field . inter actions Ċ import Ġap pt ent ive . com . android . feedback . eng agement . criteria . Field . is _ update Ċ import Ġap pt ent ive . com . android . feedback . eng agement . criteria . Field . person Ċ import Ġap pt ent ive . com . android . feedback . eng agement . criteria . Field . random Ċ import Ġap pt ent ive . com . android . feedback . eng agement . criteria . Field . sdk Ċ import Ġap pt ent ive . com . android . feedback . eng agement . criteria . Field . time _ at _ install Ċ import Ġap pt ent ive . com . android . feedback . eng agement . inter actions . Interaction Response Ċ import Ġap pt ent ive . com . android . feedback . eng agement . inter actions . Interaction ResponseData Ċ import Ġap pt ent ive . com . android . feedback . mock App Release Ċ import Ġap pt ent ive . com . android . feedback . mock Device Ċ import Ġap pt ent ive . com . android . feedback . mock Person Ċ import Ġap pt ent ive . com . android . feedback . mock Random Sampling Ċ import Ġap pt ent ive . com . android . feedback . mock Sdk Ċ import Ġap pt ent ive . com . android . feedback . model . Custom Data Ċ import Ġap pt ent ive . com . android . feedback . model . Device Ċ import Ġap pt ent ive . com . android . feedback . model . Eng agement Data Ċ import Ġap pt ent ive . com . android . feedback . model . Person Ċ import Ġap pt ent ive . com . android . feedback . model . Random Sampling Ċ import Ġap pt ent ive . com . android . feedback . model . Version History Ċ import Ġap pt ent ive . com . android . feedback . model . Version History Item Ċ import Ġap pt ent ive . com . android . util . Mock Time Source Ċ import Ġcom . google . common . truth . Truth . assertThat Ċ import Ġorg . junit . Assert . assertEquals Ċ import Ġorg . junit . Assert . assertTrue Ċ import Ġorg . junit . Test Ċ Ċ class ĠDefault Target ing State Test Ġ: ĠTestCase () Ġ{ ĊĠĠĠ Ġprivate Ġval Ġstate Ġ= ĠDefault Target ing State ( mock Person , Ġmock Device , Ġmock Sdk , Ġmock App Release , Ġmock Random Sampling , ĠEng agement Data ()) ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġapplication () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġstate Ġ= Ġstate . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġapp Release Ġ= Ġmock App Release . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġversion Name Ġ= Ġ" 1 . 0 . 0 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġversion Code Ġ= Ġ 1 0 0 0 0 0 ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( application . version _ code )). isEqualTo ( 1 0 0 0 0 0 ) ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( application . version _ name )). isEqualTo ( Version . parse (" 1 . 0 . 0 ")) ĊĊĠĠĠĠĠĠĠ Ġval Ġstate Beta Ġ= Ġstate . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġapp Release Ġ= Ġmock App Release . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġversion Name Ġ= Ġ" 1 . 0 . beta 0 1 " ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ ĠassertThat ( state Beta . getValue ( application . version _ name )). isEqualTo ( Version . parse (" 1 . 0 . beta 0 1 ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġsdk () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġstate Ġ= Ġstate . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġsdk Ġ= Ġmock Sdk . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġversion Ġ= Ġ" 6 . 5 . 4 " ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( sdk . version )). isEqualTo ( Version . parse (" 6 . 5 . 4 ")) ĊĊĠĠĠĠĠĠĠ Ġval Ġstate Alpha Ġ= Ġstate . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġsdk Ġ= Ġmock Sdk . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġversion Ġ= Ġ" 6 . 5 . 4 . 0 - alpha 0 1 " ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ ĠassertThat ( state Alpha . getValue ( sdk . version )). isEqualTo ( Version . parse (" 6 . 5 . 4 . 0 - alpha 0 1 ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġcurrent _ time () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġstate Ġ= Ġstate . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtime Source Ġ= ĠMock Time Source ( time Ġ= Ġ 1 2 3 4 . 5 ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( current _ time )). isEqualTo ( DateTime ( 1 2 3 4 . 5 )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġis _ update () Ġ{ ĊĠĠĠĠĠĠĠ Ġ// Ġempty Ġstate ĊĠĠĠĠĠĠĠ Ġvar Ġstate Ġ= Ġstate . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġeng agement Data Ġ= ĠEng agement Data () ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( is _ update . version _ code )). isEqualTo ( false ) ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( is _ update . version _ name )). isEqualTo ( false ) ĊĊĠĠĠĠĠĠĠ Ġ// Ġsingle Ġitem ĊĠĠĠĠĠĠĠ Ġstate Ġ= Ġstate . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġeng agement Data Ġ= ĠEng agement Data ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġversion History Ġ= ĠVersion History ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġitems Ġ= ĠlistOf ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠVersion History Item ( timestamp Ġ= Ġ 1 . 0 , Ġversion Code Ġ= Ġ 1 0 0 , Ġversion Name Ġ= Ġ" 1 . 0 . 0 ") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( is _ update . version _ code )). isEqualTo ( false ) ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( is _ update . version _ name )). isEqualTo ( false ) ĊĊĠĠĠĠĠĠĠ Ġ// Ġsingle Ġversion Ġcode ĊĠĠĠĠĠĠĠ Ġstate Ġ= Ġstate . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġeng agement Data Ġ= ĠEng agement Data ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġversion History Ġ= ĠVersion History ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġitems Ġ= ĠlistOf ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠVersion History Item ( timestamp Ġ= Ġ 1 . 0 , Ġversion Code Ġ= Ġ 1 0 0 , Ġversion Name Ġ= Ġ" 1 . 0 . 0 "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠVersion History Item ( timestamp Ġ= Ġ 2 . 0 , Ġversion Code Ġ= Ġ 1 0 0 , Ġversion Name Ġ= Ġ" 1 . 0 . 1 ") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( is _ update . version _ code )). isEqualTo ( false ) ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( is _ update . version _ name )). isEqualTo ( true ) ĊĊĠĠĠĠĠĠĠ Ġ// Ġsingle Ġversion Ġname ĊĠĠĠĠĠĠĠ Ġstate Ġ= Ġstate . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġeng agement Data Ġ= ĠEng agement Data ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġversion History Ġ= ĠVersion History ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġitems Ġ= ĠlistOf ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠVersion History Item ( timestamp Ġ= Ġ 1 . 0 , Ġversion Code Ġ= Ġ 1 0 0 , Ġversion Name Ġ= Ġ" 1 . 0 . 0 "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠVersion History Item ( timestamp Ġ= Ġ 2 . 0 , Ġversion Code Ġ= Ġ 1 0 1 , Ġversion Name Ġ= Ġ" 1 . 0 . 0 ") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( is _ update . version _ code )). isEqualTo ( true ) ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( is _ update . version _ name )). isEqualTo ( false ) ĊĊĠĠĠĠĠĠĠ Ġ// Ġmultiple Ġversion Ġnames Ġand Ġcodes ĊĠĠĠĠĠĠĠ Ġstate Ġ= Ġstate . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġeng agement Data Ġ= ĠEng agement Data ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġversion History Ġ= ĠVersion History ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġitems Ġ= ĠlistOf ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠVersion History Item ( timestamp Ġ= Ġ 1 . 0 , Ġversion Code Ġ= Ġ 1 0 0 , Ġversion Name Ġ= Ġ" 1 . 0 . 0 "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠVersion History Item ( timestamp Ġ= Ġ 2 . 0 , Ġversion Code Ġ= Ġ 1 0 1 , Ġversion Name Ġ= Ġ" 1 . 0 . 1 ") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( is _ update . version _ code )). isEqualTo ( true ) ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( is _ update . version _ name )). isEqualTo ( true ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtime _ at _ install _ total () Ġ{ ĊĠĠĠĠĠĠĠ Ġ// Ġempty Ġstate ĊĠĠĠĠĠĠĠ Ġvar Ġstate Ġ= Ġstate . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġeng agement Data Ġ= ĠEng agement Data ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġversion History Ġ= ĠVersion History ( time Source Ġ= ĠMock Time Source ( time Ġ= Ġ 0 . 5 )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( time _ at _ install . total )). isEqualTo ( DateTime ( 0 . 5 )) Ġ// Ġcurrent Ġtime ĊĊĠĠĠĠĠĠĠ Ġ// Ġsingle Ġitem ĊĠĠĠĠĠĠĠ Ġstate Ġ= Ġstate . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġeng agement Data Ġ= ĠEng agement Data ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġversion History Ġ= ĠVersion History ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġitems Ġ= ĠlistOf ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠVersion History Item ( timestamp Ġ= Ġ 1 . 0 , Ġversion Code Ġ= Ġ 1 0 0 , Ġversion Name Ġ= Ġ" 1 . 0 . 0 ") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( time _ at _ install . total )). isEqualTo ( DateTime ( 1 . 0 )) ĊĊĠĠĠĠĠĠĠ Ġ// Ġmultiple Ġitems ĊĠĠĠĠĠĠĠ Ġstate Ġ= Ġstate . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġeng agement Data Ġ= ĠEng agement Data ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġversion History Ġ= ĠVersion History ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġitems Ġ= ĠlistOf ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠVersion History Item ( timestamp Ġ= Ġ 1 . 0 , Ġversion Code Ġ= Ġ 1 0 0 , Ġversion Name Ġ= Ġ" 1 . 0 . 0 "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠVersion History Item ( timestamp Ġ= Ġ 2 . 0 , Ġversion Code Ġ= Ġ 2 0 0 , Ġversion Name Ġ= Ġ" 2 . 0 . 0 ") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( time _ at _ install . total )). isEqualTo ( DateTime ( 1 . 0 )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtime _ at _ install _ version () Ġ{ ĊĠĠĠĠĠĠĠ Ġ// Ġempty Ġstate ĊĠĠĠĠĠĠĠ Ġvar Ġstate Ġ= Ġstate . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġapp Release Ġ= Ġmock App Release . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġversion Code Ġ= Ġ 1 0 0 , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġversion Name Ġ= Ġ" 1 . 0 . 0 " ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġeng agement Data Ġ= ĠEng agement Data ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġversion History Ġ= ĠVersion History ( time Source Ġ= ĠMock Time Source ( time Ġ= Ġ 0 . 5 )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( time _ at _ install . version _ code )). isEqualTo ( DateTime ( 0 . 5 )) Ġ// Ġcurrent Ġtime ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( time _ at _ install . version _ name )). isEqualTo ( DateTime ( 0 . 5 )) Ġ// Ġcurrent Ġtime ĊĊĠĠĠĠĠĠĠ Ġ// Ġsingle Ġitem ĊĠĠĠĠĠĠĠ Ġstate Ġ= Ġstate . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġeng agement Data Ġ= ĠEng agement Data ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġversion History Ġ= ĠVersion History ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġitems Ġ= ĠlistOf ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠVersion History Item ( timestamp Ġ= Ġ 1 . 0 , Ġversion Code Ġ= Ġ 1 0 0 , Ġversion Name Ġ= Ġ" 1 . 0 . 0 ") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( time _ at _ install . version _ code )). isEqualTo ( DateTime ( 1 . 0 )) ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( time _ at _ install . version _ name )). isEqualTo ( DateTime ( 1 . 0 )) ĊĊĠĠĠĠĠĠĠ Ġ// Ġmultiple Ġitems ĊĠĠĠĠĠĠĠ Ġstate Ġ= Ġstate . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġeng agement Data Ġ= ĠEng agement Data ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġversion History Ġ= ĠVersion History ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġitems Ġ= ĠlistOf ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠVersion History Item ( timestamp Ġ= Ġ 1 . 0 , Ġversion Code Ġ= Ġ 1 0 0 , Ġversion Name Ġ= Ġ" 1 . 0 . 0 "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠVersion History Item ( timestamp Ġ= Ġ 2 . 0 , Ġversion Code Ġ= Ġ 2 0 0 , Ġversion Name Ġ= Ġ" 2 . 0 . 0 ") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( time _ at _ install . version _ code )). isEqualTo ( DateTime ( 1 . 0 )) ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( time _ at _ install . version _ name )). isEqualTo ( DateTime ( 1 . 0 )) ĊĊĠĠĠĠĠĠĠ Ġ// Ġoverride Ġapp Ġversion ĊĠĠĠĠĠĠĠ Ġstate Ġ= Ġstate . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġapp Release Ġ= Ġmock App Release . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġversion Code Ġ= Ġ 2 0 0 , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġversion Name Ġ= Ġ" 2 . 0 . 0 " ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( time _ at _ install . version _ code )). isEqualTo ( DateTime ( 2 . 0 )) ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( time _ at _ install . version _ name )). isEqualTo ( DateTime ( 2 . 0 )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġcode _ point () Ġ{ ĊĠĠĠĠĠĠĠ Ġvar Ġstate Ġ= Ġstate . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġeng agement Data Ġ= ĠEng agement Data (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġapp Release Ġ= Ġmock App Release . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġversion Code Ġ= Ġ 1 0 0 , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġversion Name Ġ= Ġ" 1 . 0 . 0 " ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġval Ġevent Ġ= ĠEvent . local (" event ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( code _ point . inv okes . total ( event ))). isEqualTo ( 0 ) ĊĊĠĠĠĠĠĠĠ Ġstate Ġ= Ġstate . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġeng agement Data Ġ= ĠEng agement Data () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. add Invoke ( event , Ġ" 1 . 0 . 0 ", Ġ 1 0 0 , ĠDateTime ( 1 0 . 0 )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. add Invoke ( event , Ġ" 1 . 0 . 0 ", Ġ 1 0 1 , ĠDateTime ( 2 0 . 0 )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. add Invoke ( event , Ġ" 1 . 0 . 1 ", Ġ 1 0 1 , ĠDateTime ( 3 0 . 0 )) ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( code _ point . inv okes . total ( event ))). isEqualTo ( 3 ) ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( code _ point . inv okes . version _ code ( event ))). isEqualTo ( 1 ) ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( code _ point . inv okes . version _ name ( event ))). isEqualTo ( 2 ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( code _ point . last _ inv oked _ at . total ( event ))). isEqualTo ( DateTime ( 3 0 . 0 )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġinteractions () Ġ{ ĊĠĠĠĠĠĠĠ Ġvar Ġstate Ġ= Ġstate . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġeng agement Data Ġ= ĠEng agement Data (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġapp Release Ġ= Ġmock App Release . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġversion Code Ġ= Ġ 1 0 0 , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġversion Name Ġ= Ġ" 1 . 0 . 0 " ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġval Ġinteraction Id Ġ= Ġ" 1 2 3 4 5 " ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( inter actions . inv okes . total ( interaction Id ))). isEqualTo ( 0 ) ĊĊĠĠĠĠĠĠĠ Ġstate Ġ= Ġstate . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġeng agement Data Ġ= ĠEng agement Data () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. add Invoke ( interaction Id , Ġ" 1 . 0 . 0 ", Ġ 1 0 0 , ĠDateTime ( 1 0 . 0 )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. add Invoke ( interaction Id , Ġ" 1 . 0 . 0 ", Ġ 1 0 1 , ĠDateTime ( 2 0 . 0 )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. add Invoke ( interaction Id , Ġ" 1 . 0 . 1 ", Ġ 1 0 1 , ĠDateTime ( 3 0 . 0 )) ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( inter actions . inv okes . total ( interaction Id ))). isEqualTo ( 3 ) ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( inter actions . inv okes . version _ code ( interaction Id ))). isEqualTo ( 1 ) ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( inter actions . inv okes . version _ name ( interaction Id ))). isEqualTo ( 2 ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( inter actions . last _ inv oked _ at . total ( interaction Id ))). isEqualTo ( DateTime ( 3 0 . 0 )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġinteraction Responses () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġresponse Id 1 Ġ= Ġ" abc 1 2 3 " ĊĠĠĠĠĠĠĠ Ġval Ġresponses 1 Ġ= Ġset Of ( Interaction Response . Id Response (" aaa 1 1 1 ")) ĊĠĠĠĠĠĠĠ Ġval Ġresponse Id 2 Ġ= Ġ" aaaa aa " ĊĠĠĠĠĠĠĠ Ġval Ġresponses 2 Ġ= Ġset Of ( Interaction Response . Long Response ( 1 1 1 1 1 1 )) ĊĠĠĠĠĠĠĠ Ġval Ġresponse Id 3 Ġ= Ġ" fs q 1 2 4 " ĊĠĠĠĠĠĠĠ Ġval Ġresponses 3 Ġ= Ġset Of ( Interaction Response . String Response (" abc 1 2 3 ")) ĊĠĠĠĠĠĠĠ Ġval Ġresponse Id 4 Ġ= Ġ" aaa " ĊĠĠĠĠĠĠĠ Ġval Ġresponses 4 Ġ= Ġset Of ( Interaction Response . Other Response (" aaa ", Ġ" 1 1 1 ")) ĊĠĠĠĠĠĠĠ Ġval Ġresponse Id 5 Ġ= Ġ" 3 2 1 cba " ĊĠĠĠĠĠĠĠ Ġval Ġresponses 5 Ġ= Ġset Of ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠInteraction Response . Id Response (" bbb 2 2 2 "), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠInteraction Response . Other Response (" bbb ", Ġ" 2 2 2 ") ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġval Ġstate Ġ= Ġstate . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġeng agement Data Ġ= ĠEng agement Data ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġinteraction Responses Ġ= Ġmutable Map Of ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġresponse Id 1 Ġto ĠInteraction ResponseData ( responses 1 ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġresponse Id 2 Ġto ĠInteraction ResponseData ( responses 2 ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġresponse Id 3 Ġto ĠInteraction ResponseData ( responses 3 ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġresponse Id 4 Ġto ĠInteraction ResponseData ( responses 4 ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġresponse Id 5 Ġto ĠInteraction ResponseData ( responses 5 ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( responses 1 , Ġstate . getValue ( inter actions . answers . id ( response Id 1 ))) ĊĠĠĠĠĠĠĠ ĠassertEquals ( responses 2 , Ġstate . getValue ( inter actions . answers . value ( response Id 2 ))) ĊĠĠĠĠĠĠĠ ĠassertEquals ( responses 3 , Ġstate . getValue ( inter actions . answers . value ( response Id 3 ))) ĊĠĠĠĠĠĠĠ ĠassertEquals ( responses 4 , Ġstate . getValue ( inter actions . answers . id ( response Id 4 ))) ĊĠĠĠĠĠĠĠ ĠassertEquals ( responses 4 , Ġstate . getValue ( inter actions . answers . value ( response Id 4 ))) ĊĠĠĠĠĠĠĠ ĠassertEquals ( responses 5 , Ġstate . getValue ( inter actions . answers . id ( response Id 5 ))) ĊĠĠĠĠĠĠĠ ĠassertEquals ( responses 5 , Ġstate . getValue ( inter actions . answers . value ( response Id 5 ))) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġperson () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġstate Ġ= Ġstate . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġperson Ġ= ĠPerson ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġemail Ġ= Ġ" person @ company . com ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġname Ġ= Ġ" First ĠLast ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcustom Data Ġ= ĠCustom Data ( map Of (" person _ key " Ġto Ġ" person _ value ")) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( person . name )). isEqualTo (" First ĠLast ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( person . email )). isEqualTo (" person @ company . com ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( person . custom _ data (" person _ key ")) ). isEqualTo (" person _ value ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġperson Missing Data () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġstate Ġ= Ġstate . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġperson Ġ= ĠPerson () ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( person . name )). isNull () ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( person . email )). isNull () ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( person . custom _ data (" person _ key ")) ). isNull () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġdevice () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġstate Ġ= Ġstate . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdevice Ġ= Ġmock Device . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġos Name Ġ= Ġ" device _ os _ name ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġos Version Ġ= Ġ" 1 2 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġos Build Ġ= Ġ" device _ os _ build ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġos Api Level Ġ= Ġ 3 0 , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġmanufacturer Ġ= Ġ" device _ manufacturer ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġmodel Ġ= Ġ" device _ model ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġboard Ġ= Ġ" device _ board ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġproduct Ġ= Ġ" device _ product ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġbrand Ġ= Ġ" device _ brand ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcpu Ġ= Ġ" device _ cpu ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġdevice Ġ= Ġ" device _ device ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġuuid Ġ= Ġ" device _ uuid ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġbuild Type Ġ= Ġ" device _ build _ type ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġbuild Id Ġ= Ġ" device _ build _ id ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcarrier Ġ= Ġ" device _ carrier ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcurrent Carrier Ġ= Ġ" device _ current _ carrier ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġnetwork Type Ġ= Ġ" device _ network _ type ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġboot loader Version Ġ= Ġ" device _ boot loader _ version ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġradio Version Ġ= Ġ" device _ radio _ version ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġlocale CountryCode Ġ= Ġ" device _ locale _ country _ code ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġlocale Language Code Ġ= Ġ" device _ locale _ language _ code ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġlocale Raw Ġ= Ġ" device _ locale _ raw ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġut c Offset Ġ= Ġ 1 8 0 0 0 , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcustom Data Ġ= ĠCustom Data ( map Of (" device _ key " Ġto Ġ" device _ value ")) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . os _ name )). isEqualTo (" device _ os _ name ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . os _ version )). isEqualTo ( Version ( 1 2 , Ġ 0 , Ġ 0 , Ġ 0 )) ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . os _ build )). isEqualTo (" device _ os _ build ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . manufacturer )). isEqualTo (" device _ manufacturer ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . model )). isEqualTo (" device _ model ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . board )). isEqualTo (" device _ board ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . product )). isEqualTo (" device _ product ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . brand )). isEqualTo (" device _ brand ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . cpu )). isEqualTo (" device _ cpu ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . hardware )). isNull () ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . device )). isEqualTo (" device _ device ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . uuid )). isEqualTo (" device _ uuid ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . carrier )). isEqualTo (" device _ carrier ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . current _ carrier )). isEqualTo (" device _ current _ carrier ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . network _ type )). isEqualTo (" device _ network _ type ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . build _ type )). isEqualTo (" device _ build _ type ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . build _ id )). isEqualTo (" device _ build _ id ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . boot loader _ version )). isEqualTo (" device _ boot loader _ version ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . radio _ version )). isEqualTo (" device _ radio _ version ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . locale _ country _ code )). isEqualTo (" device _ locale _ country _ code ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . locale _ language _ code )). isEqualTo (" device _ locale _ language _ code ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . locale _ raw )). isEqualTo (" device _ locale _ raw ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . os _ api _ level )). isEqualTo ( 3 0 ) ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . utc _ offset )). isEqualTo ( 1 8 0 0 0 ) ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . custom _ data (" device _ key ")) ). isEqualTo (" device _ value ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġdevice Missing Data () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġstate Ġ= Ġstate . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdevice Ġ= ĠDevice ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġos Name Ġ= Ġ" device _ os _ name ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġos Version Ġ= Ġ" 1 2 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġos Build Ġ= Ġ" device _ os _ build ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġos Api Level Ġ= Ġ 3 0 , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġmanufacturer Ġ= Ġ" device _ manufacturer ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġmodel Ġ= Ġ" device _ model ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġboard Ġ= Ġ" device _ board ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġproduct Ġ= Ġ" device _ product ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġbrand Ġ= Ġ" device _ brand ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcpu Ġ= Ġ" device _ cpu ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġdevice Ġ= Ġ" device _ device ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġuuid Ġ= Ġ" device _ uuid ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġbuild Type Ġ= Ġ" device _ build _ type ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġbuild Id Ġ= Ġ" device _ build _ id ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġlocale CountryCode Ġ= Ġ" device _ locale _ country _ code ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġlocale Language Code Ġ= Ġ" device _ locale _ language _ code ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġlocale Raw Ġ= Ġ" device _ locale _ raw ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġut c Offset Ġ= Ġ 1 8 0 0 0 ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . os _ name )). isEqualTo (" device _ os _ name ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . os _ version )). isEqualTo ( Version ( 1 2 , Ġ 0 , Ġ 0 , Ġ 0 )) ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . os _ build )). isEqualTo (" device _ os _ build ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . manufacturer )). isEqualTo (" device _ manufacturer ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . model )). isEqualTo (" device _ model ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . board )). isEqualTo (" device _ board ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . product )). isEqualTo (" device _ product ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . brand )). isEqualTo (" device _ brand ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . cpu )). isEqualTo (" device _ cpu ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . hardware )). isNull () ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . device )). isEqualTo (" device _ device ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . uuid )). isEqualTo (" device _ uuid ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . carrier )). isNull () ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . current _ carrier )). isNull () ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . network _ type )). isNull () ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . build _ type )). isEqualTo (" device _ build _ type ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . build _ id )). isEqualTo (" device _ build _ id ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . boot loader _ version )). isNull () ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . radio _ version )). isNull () ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . locale _ country _ code )). isEqualTo (" device _ locale _ country _ code ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . locale _ language _ code )). isEqualTo (" device _ locale _ language _ code ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . locale _ raw )). isEqualTo (" device _ locale _ raw ") ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . os _ api _ level )). isEqualTo ( 3 0 ) ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . utc _ offset )). isEqualTo ( 1 8 0 0 0 ) ĊĠĠĠĠĠĠĠ ĠassertThat ( state . getValue ( device . custom _ data (" device _ key ")) ). isNull () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġrandom Sampling With Id () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġstate Ġ= Ġstate . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġrandom Sampling Ġ= ĠRandom Sampling ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġpercent s Ġ= Ġmutable Map Of ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" id 1 " Ġto Ġ 0 . 1 , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" id 2 " Ġto Ġ 9 9 . 9 , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" id 3 " Ġto Ġ 5 0 . 0 ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( 0 . 1 , Ġstate . getValue ( random . percent _ with _ id (" id 1 "))) ĊĠĠĠĠĠĠĠ ĠassertEquals ( 9 9 . 9 , Ġstate . getValue ( random . percent _ with _ id (" id 2 "))) ĊĠĠĠĠĠĠĠ ĠassertEquals ( 5 0 . 0 , Ġstate . getValue ( random . percent _ with _ id (" id 3 "))) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġrandom Sampling () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġstate Ġ= Ġstate . copy ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġrandom Sampling Ġ= ĠRandom Sampling () ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġrepeat ( 1 0 0 ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġrandom Value Ġ= Ġstate . getValue ( random . percent ) Ġas ĠDouble ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertTrue ( random Value Ġ< Ġ 1 0 0 . 0 ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertTrue ( random Value Ġ>= Ġ 0 . 0 ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ