package Ġme . tank ery . just note . data . db . dao Ċ Ċ import Ġandroidx . test . ext . junit . runners . Android JUnit 4 Ċ import Ġme . tank ery . just note . data . db . pojo . Note Tag Join Ċ import Ġme . tank ery . just note . utils . getValue Blocking Ċ import Ġme . tank ery . just note . utils . map Value Blocking Ċ import Ġme . tank ery . just note . utils . test Join s Ċ import Ġme . tank ery . just note . utils . test Notes Ċ import Ġme . tank ery . just note . utils . test Tags Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ Ċ @ RunWith ( Android JUnit 4 :: class ) Ċ class ĠNote Tag Dao Test Ġ: ĠDao Test () Ġ{ ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġnote Tag Dao : ĠNote Tag Dao ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġoverride Ġfun ĠsetUp () Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . setUp () ĊĠĠĠĠĠĠĠ Ġdatabase . note Dao (). insert ( test Notes ) ĊĠĠĠĠĠĠĠ Ġdatabase . tag Dao (). insert ( test Tags ) ĊĠĠĠĠĠĠĠ Ġnote Tag Dao Ġ= Ġdatabase . note Tag Dao (). apply Ġ{ Ġinsert ( test Join s ) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠtestGet Tag Of Note () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtags Factory Ġ= Ġnote Tag Dao . getTag Of Note (" note - 0 ") ĊĠĠĠĠĠĠĠ Ġval Ġtags Ġ= Ġtags Factory . getValue Blocking (). map Ġ{ Ġit . id Ġ} ĊĊĠĠĠĠĠĠĠ ĠassertThat ( tags ). contains Exactly ("_ pinned _", Ġ" task ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠtestGet Notes Of Tag () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġnote Ids Ġ= Ġnote Tag Dao . get Notes Of Tag ("_ arch ived _ ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. map Value Blocking Ġ{ Ġid Ġ} ĊĊĠĠĠĠĠĠĠ ĠassertThat ( note Ids ). contains Exactly (" note - 2 ", Ġ" note - 1 ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠtestGet Notes Not Tag () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġnote Ids Ġ= Ġnote Tag Dao . get Notes Not Tag ("_ deleted _", Ġ"_ arch ived _ ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. map Value Blocking Ġ{ Ġid Ġ} ĊĊĠĠĠĠĠĠĠ ĠassertThat ( note Ids ). contains Exactly (" note - 3 ", Ġ" note - 0 ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠtestGet Notes Of Tag With Exception () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġnote Ids Ġ= Ġnote Tag Dao . get Notes Of Tag (" task ", Ġ"_ deleted _", Ġ"_ arch ived _ ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. map Value Blocking Ġ{ Ġid Ġ} ĊĊĠĠĠĠĠĠĠ ĠassertThat ( note Ids ). contains Exactly (" note - 0 ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Insert () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġjoin Ġ= ĠNote Tag Join ( test Notes [ 3 ]. id , Ġ" good _ stuff ") ĊĠĠĠĠĠĠĠ Ġnote Tag Dao . insert ( join ) ĊĊĠĠĠĠĠĠĠ Ġval Ġnote Ids Ġ= Ġnote Tag Dao . get Notes Of Tag (" good _ stuff ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. map Value Blocking Ġ{ Ġid Ġ} ĊĊĠĠĠĠĠĠĠ ĠassertThat ( note Ids ). contains Exactly (" note - 3 ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Insert Duplicate () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġjoin Ġ= ĠNote Tag Join ( test Notes [ 0 ]. id , Ġ" task ") ĊĠĠĠĠĠĠĠ Ġnote Tag Dao . insert ( join ) ĊĊĠĠĠĠĠĠĠ Ġval Ġnote Ids Ġ= Ġnote Tag Dao . get Notes Of Tag (" task ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. map Value Blocking Ġ{ Ġid Ġ} ĊĊĠĠĠĠĠĠĠ ĠassertThat ( note Ids ). contains (" note - 0 ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Delete () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġjoin Ġ= ĠNote Tag Join ( test Notes [ 0 ]. id , Ġ" task ") ĊĠĠĠĠĠĠĠ Ġnote Tag Dao . delete ( join ) ĊĊĠĠĠĠĠĠĠ Ġval Ġnote Ids Ġ= Ġnote Tag Dao . get Notes Of Tag (" task ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. map Value Blocking Ġ{ Ġid Ġ} ĊĊĠĠĠĠĠĠĠ ĠassertThat ( note Ids ). does Not Contain (" note - 0 ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Delete Non Exist () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġjoin Ġ= ĠNote Tag Join ( test Notes [ 3 ]. id , Ġ" task ") ĊĠĠĠĠĠĠĠ Ġnote Tag Dao . delete ( join ) ĊĊĠĠĠĠĠĠĠ Ġval Ġnote Ids Ġ= Ġnote Tag Dao . get Notes Of Tag (" task ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. map Value Blocking Ġ{ Ġid Ġ} ĊĊĠĠĠĠĠĠĠ ĠassertThat ( note Ids ). contains Exactly (" note - 2 ", Ġ" note - 0 ") ĊĠĠĠ Ġ} Ċ Ċ }