package Ġcom . mar mute ch . ram d ant ime table . ram ad ant ime table . db Ċ Ċ import Ġandroidx . test . runner . Android JUnit 4 Ċ import Ġcom . mar mute ch . ram d ant ime table . ram ad ant ime table . LiveData TestUtil . getValue Ċ import Ġcom . mar mute ch . ram d ant ime table . ram ad ant ime table . TestUtil Ċ import Ġorg . hamcrest . Core Matchers Ċ import Ġorg . hamcrest . Core Matchers .` is ` Ċ import Ġorg . hamcrest . Matcher Assert . assertThat Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ Ċ @ RunWith ( Android JUnit 4 :: class ) Ċ class ĠTime Table Day DB Test Ġ: ĠDb Test () Ġ{ ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġinsert And Read () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtime Table Day Ġ= ĠTest Util . create Tim table Day ( 1 , Ġ" 1 2 3 4 5 6 ", Ġ" 6 5 4 3 2 1 ") ĊĠĠĠĠĠĠĠ Ġdb . timetable Dao (). insert ( time Table Day ) ĊĠĠĠĠĠĠĠ Ġval Ġloaded Ġ= ĠgetValue ( db . timetable Dao (). get Day ById ( time Table Day . objectId )) ĊĠĠĠĠĠĠĠ ĠassertThat ( loaded , ĠCore Matchers . notNull Value ()) ĊĠĠĠĠĠĠĠ ĠassertThat ( loaded . objectId , Ġ` is `( time Table Day . objectId )) ĊĠĠĠĠĠĠĠ ĠassertThat ( loaded . calendar Day , Ġ` is `( time Table Day . calendar Day )) ĊĠĠĠĠĠĠĠ ĠassertThat ( loaded . country Id , Ġ` is `( time Table Day . country Id )) ĊĠĠĠĠĠĠĠ ĠassertThat ( loaded . state Id , Ġ` is `( time Table Day . state Id )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġinsert Multiple () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtime Table Day 1 Ġ= ĠTest Util . create Tim table Day ( 1 , Ġ" 2 F 9 5 F DB A - 5 3 5 9 - 4 D 4 7 - B ED 0 - 0 2 5 3 5 E 9 6 5 AC 2 ", Ġ" 9 7 BA 5 5 0 9 - C 2 2 2 - 4 ED 4 - B 4 8 0 - CA E 8 4 4 FF C 8 D 6 ") ĊĠĠĠĠĠĠĠ Ġval Ġtime Table Day 2 Ġ= ĠTest Util . create Tim table Day ( 2 , Ġ" 2 F 9 5 F DB A - 5 3 5 9 - 4 D 4 7 - B ED 0 - 0 2 5 3 5 E 9 6 5 AC 2 ", Ġ" 9 7 BA 5 5 0 9 - C 2 2 2 - 4 ED 4 - B 4 8 0 - CA E 8 4 4 FF C 8 D 6 ") ĊĠĠĠĠĠĠĠ Ġval Ġtime Table Day 3 Ġ= ĠTest Util . create Tim table Day ( 3 , Ġ" 2 F 9 5 F DB A - 5 3 5 9 - 4 D 4 7 - B ED 0 - 0 2 5 3 5 E 9 6 5 AC 2 ", Ġ" 9 7 BA 5 5 0 9 - C 2 2 2 - 4 ED 4 - B 4 8 0 - CA E 8 4 4 FF C 8 D 6 ") ĊĠĠĠĠĠĠĠ Ġdb . beginTransaction () ĊĠĠĠĠĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdb . timetable Dao (). bulk Insert ( array ListOf ( time Table Day 1 , Ġtime Table Day 2 , Ġtime Table Day 3 )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdb . set Transaction Successful () ĊĠĠĠĠĠĠĠ Ġ} Ġfinally Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdb . end Transaction () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġlist Ġ= ĠgetValue ( db . timetable Dao (). get Day By State Id (" 9 7 BA 5 5 0 9 - C 2 2 2 - 4 ED 4 - B 4 8 0 - CA E 8 4 4 FF C 8 D 6 ", Ġ 3 , Ġ 0 )) ĊĠĠĠĠĠĠĠ ĠassertThat ( list . size , Ġ` is `( 3 )) ĊĠĠĠĠĠĠĠ Ġval Ġfirst Ġ= Ġlist [ 0 ] ĊĊĠĠĠĠĠĠĠ ĠassertThat ( first . day , Ġ` is `( 1 )) ĊĠĠĠĠĠĠĠ ĠassertThat ( first . du a Ar , Ġ` is `( time Table Day 1 . du a Ar )) ĊĠĠĠĠĠĠĠ ĠassertThat ( first . du a En , Ġ` is `( time Table Day 1 . du a En )) ĊĠĠĠĠĠĠĠ ĠassertThat ( first . day Mm , Ġ` is `( time Table Day 1 . day Mm )) ĊĊĠĠĠĠĠĠĠ Ġval Ġsecond Ġ= Ġlist [ 1 ] ĊĠĠĠĠĠĠĠ ĠassertThat ( second . day , Ġ` is `( 2 )) ĊĠĠĠĠĠĠĠ ĠassertThat ( second . du a Ar , Ġ` is `( time Table Day 2 . du a Ar )) ĊĠĠĠĠĠĠĠ ĠassertThat ( second . du a En , Ġ` is `( time Table Day 2 . du a En )) ĊĊĠĠĠĠĠĠĠ Ġval Ġthird Ġ= Ġlist [ 2 ] ĊĠĠĠĠĠĠĠ ĠassertThat ( third . day , Ġ` is `( 3 )) ĊĠĠĠĠĠĠĠ ĠassertThat ( third . du a Ar , Ġ` is `( time Table Day 3 . du a Ar )) ĊĠĠĠĠĠĠĠ ĠassertThat ( third . day Mm , Ġ` is `( time Table Day 3 . day Mm )) ĊĠĠĠ Ġ} Ċ }