11package org.schabi.newpipe.local.history
22
33import androidx.test.core.app.ApplicationProvider
4+ import java.time.LocalDateTime
5+ import java.time.OffsetDateTime
6+ import java.time.ZoneOffset
47import org.assertj.core.api.Assertions.assertThat
58import org.junit.After
69import org.junit.Assert.assertEquals
@@ -11,9 +14,6 @@ import org.schabi.newpipe.database.AppDatabase
1114import org.schabi.newpipe.database.history.model.SearchHistoryEntry
1215import org.schabi.newpipe.testUtil.TestDatabase
1316import org.schabi.newpipe.testUtil.TrampolineSchedulerRule
14- import java.time.LocalDateTime
15- import java.time.OffsetDateTime
16- import java.time.ZoneOffset
1717
1818class HistoryRecordManagerTest {
1919
@@ -54,7 +54,7 @@ class HistoryRecordManagerTest {
5454 SearchHistoryEntry (creationDate = time.minusSeconds(1 ), serviceId = 0 , search = " A" ),
5555 SearchHistoryEntry (creationDate = time.minusSeconds(2 ), serviceId = 2 , search = " A" ),
5656 SearchHistoryEntry (creationDate = time.minusSeconds(3 ), serviceId = 1 , search = " B" ),
57- SearchHistoryEntry (creationDate = time.minusSeconds(4 ), serviceId = 0 , search = " B" ),
57+ SearchHistoryEntry (creationDate = time.minusSeconds(4 ), serviceId = 0 , search = " B" )
5858 )
5959
6060 // make sure all 4 were inserted
@@ -85,7 +85,7 @@ class HistoryRecordManagerTest {
8585 val entries = listOf (
8686 SearchHistoryEntry (creationDate = time.minusSeconds(1 ), serviceId = 1 , search = " A" ),
8787 SearchHistoryEntry (creationDate = time.minusSeconds(2 ), serviceId = 2 , search = " B" ),
88- SearchHistoryEntry (creationDate = time.minusSeconds(3 ), serviceId = 0 , search = " C" ),
88+ SearchHistoryEntry (creationDate = time.minusSeconds(3 ), serviceId = 0 , search = " C" )
8989 )
9090
9191 // make sure all 3 were inserted
@@ -98,7 +98,6 @@ class HistoryRecordManagerTest {
9898 }
9999
100100 private fun insertShuffledRelatedSearches (relatedSearches : Collection <SearchHistoryEntry >) {
101-
102101 // shuffle to make sure the order of items returned by queries depends only on
103102 // SearchHistoryEntry.creationDate, not on the actual insertion time, so that we can
104103 // verify that the `ORDER BY` clause does its job
@@ -121,7 +120,7 @@ class HistoryRecordManagerTest {
121120 RELATED_SEARCHES_ENTRIES [6 ].search, // A (even if in two places)
122121 RELATED_SEARCHES_ENTRIES [4 ].search, // B
123122 RELATED_SEARCHES_ENTRIES [5 ].search, // AA
124- RELATED_SEARCHES_ENTRIES [2 ].search, // BA
123+ RELATED_SEARCHES_ENTRIES [2 ].search // BA
125124 )
126125 }
127126
@@ -136,7 +135,7 @@ class HistoryRecordManagerTest {
136135 SearchHistoryEntry (creationDate = time.minusSeconds(4 ), serviceId = 3 , search = " A" ),
137136 SearchHistoryEntry (creationDate = time.minusSeconds(3 ), serviceId = 3 , search = " A" ),
138137 SearchHistoryEntry (creationDate = time.minusSeconds(2 ), serviceId = 0 , search = " A" ),
139- SearchHistoryEntry (creationDate = time.minusSeconds(1 ), serviceId = 2 , search = " AA" ),
138+ SearchHistoryEntry (creationDate = time.minusSeconds(1 ), serviceId = 2 , search = " AA" )
140139 )
141140 insertShuffledRelatedSearches(relatedSearches)
142141
@@ -153,7 +152,7 @@ class HistoryRecordManagerTest {
153152 assertThat(searches).containsExactly(
154153 RELATED_SEARCHES_ENTRIES [6 ].search, // A (even if in two places)
155154 RELATED_SEARCHES_ENTRIES [5 ].search, // AA
156- RELATED_SEARCHES_ENTRIES [1 ].search, // BA
155+ RELATED_SEARCHES_ENTRIES [1 ].search // BA
157156 )
158157
159158 // also make sure that the string comparison is case insensitive
@@ -171,7 +170,7 @@ class HistoryRecordManagerTest {
171170 SearchHistoryEntry (creationDate = time.minusSeconds(4 ), serviceId = 3 , search = " A" ),
172171 SearchHistoryEntry (creationDate = time.minusSeconds(2 ), serviceId = 0 , search = " B" ),
173172 SearchHistoryEntry (creationDate = time.minusSeconds(3 ), serviceId = 2 , search = " AA" ),
174- SearchHistoryEntry (creationDate = time.minusSeconds(1 ), serviceId = 1 , search = " A" ),
173+ SearchHistoryEntry (creationDate = time.minusSeconds(1 ), serviceId = 1 , search = " A" )
175174 )
176175 }
177176}
0 commit comments