package Ġde . r ki . cor on aw arn app . presence tracing . storage Ċ Ċ import Ġandroidx . room . Room Ċ import Ġandroidx . test . core . app . Application Provider Ċ import Ġde . r ki . cor on aw arn app . presence tracing . storage . Trace Location Database Data . test Trace Location 1 Ċ import Ġde . r ki . cor on aw arn app . presence tracing . storage . Trace Location Database Data . test Trace Location 2 Ċ import Ġio . kot est . matchers . shouldBe Ċ import Ġkotlinx . coroutines . flow . first Ċ import Ġkotlinx . coroutines . run Blocking Ċ import Ġorg . junit . After Ċ import Ġorg . junit . Test Ċ import Ġtest helpers . Base Test Instrumentation Ċ Ċ class ĠTrace Location Dao Test Ġ: ĠBaseTest Instrumentation () Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġtrace Location Database Ġ= ĠRoom . in Memory Database Builder ( ĊĠĠĠĠĠĠĠ ĠApplication Provider . getApplicationContext (), ĊĠĠĠĠĠĠĠ ĠTrace Location Database :: class . java ĊĠĠĠ Ġ). build () ĊĊĠĠĠ Ġprivate Ġval Ġtrace Location Dao Ġ= Ġtrace Location Database . trace Location Dao () ĊĊĠĠĠ Ġ@ After ĊĠĠĠ Ġfun ĠtearDown () Ġ{ ĊĠĠĠĠĠĠĠ Ġtrace Location Database . clear All Tables () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtrace Location Dao Should Return No Entries Init ially () Ġ= Ġrun Blocking Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtrace Locations Flow Ġ= Ġtrace Location Dao . all Entries () ĊĊĠĠĠĠĠĠĠ Ġtrace Locations Flow . first () ĠshouldBe Ġempty List () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtrace Location Dao Should Successfully Insert Trace Location () Ġ= Ġrun Blocking Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtrace Locations Flow Ġ= Ġtrace Location Dao . all Entries () ĊĊĠĠĠĠĠĠĠ Ġtrace Location Dao . insert ( test Trace Location 1 ) ĊĊĠĠĠĠĠĠĠ Ġtrace Locations Flow . first () ĠshouldBe ĠlistOf ( test Trace Location 1 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtrace Location Dao Should Successfully Insert Multiple Trace Locations () Ġ= Ġrun Blocking Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtrace Locations Flow Ġ= Ġtrace Location Dao . all Entries () ĊĊĠĠĠĠĠĠĠ Ġtrace Location Dao . insert ( test Trace Location 1 ) ĊĠĠĠĠĠĠĠ Ġtrace Location Dao . insert ( test Trace Location 2 ) ĊĊĠĠĠĠĠĠĠ Ġtrace Locations Flow . first () ĠshouldBe ĠlistOf ( test Trace Location 1 , Ġtest Trace Location 2 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtrace Location Dao Should Successfully Delete Single Trace Location () Ġ= Ġrun Blocking Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtrace Locations Flow Ġ= Ġtrace Location Dao . all Entries () ĊĊĠĠĠĠĠĠĠ Ġtrace Location Dao . insert ( test Trace Location 1 ) ĊĠĠĠĠĠĠĠ Ġtrace Location Dao . delete ( test Trace Location 1 ) ĊĠĠĠĠĠĠĠ Ġtrace Locations Flow . first () ĠshouldBe Ġempty List () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtrace Location Dao Should Successfully Delete All Trace Locations () Ġ= Ġrun Blocking Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtrace Locations Flow Ġ= Ġtrace Location Dao . all Entries () ĊĊĠĠĠĠĠĠĠ Ġtrace Location Dao . insert ( test Trace Location 1 ) ĊĠĠĠĠĠĠĠ Ġtrace Location Dao . insert ( test Trace Location 2 ) ĊĠĠĠĠĠĠĠ Ġtrace Location Dao . delete All () ĊĠĠĠĠĠĠĠ Ġtrace Locations Flow . first () ĠshouldBe Ġempty List () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġentry For Id Should Return Correct Entry () Ġ= Ġrun Blocking Ġ{ ĊĠĠĠĠĠĠĠ Ġtrace Location Dao . insert ( test Trace Location 1 ) ĊĠĠĠĠĠĠĠ Ġtrace Location Dao . insert ( test Trace Location 2 ) ĊĊĠĠĠĠĠĠĠ Ġtrace Location Dao . entity For Id ( 0 ) ĠshouldBe Ġnull ĊĠĠĠĠĠĠĠ Ġtrace Location Dao . entity For Id ( 1 ) ĠshouldBe Ġtest Trace Location 1 ĊĠĠĠĠĠĠĠ Ġtrace Location Dao . entity For Id ( 2 ) ĠshouldBe Ġtest Trace Location 2 ĊĠĠĠ Ġ} Ċ } Ċ