|
|
|
@ -4,7 +4,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 |
|
|
|
import io.realm.RealmList |
|
|
|
import io.realm.RealmList |
|
|
|
import net.pokeranalytics.android.components.BaseFilterInstrumentedUnitTest |
|
|
|
import net.pokeranalytics.android.components.BaseFilterInstrumentedUnitTest |
|
|
|
import net.pokeranalytics.android.model.TableSize |
|
|
|
import net.pokeranalytics.android.model.TableSize |
|
|
|
import net.pokeranalytics.android.model.filter.QueryType |
|
|
|
import net.pokeranalytics.android.model.filter.QueryCondition |
|
|
|
import net.pokeranalytics.android.model.realm.* |
|
|
|
import net.pokeranalytics.android.model.realm.* |
|
|
|
import net.pokeranalytics.android.ui.view.rowrepresentable.FilterElementRow |
|
|
|
import net.pokeranalytics.android.ui.view.rowrepresentable.FilterElementRow |
|
|
|
import net.pokeranalytics.android.ui.view.rowrepresentable.FilterSectionRow |
|
|
|
import net.pokeranalytics.android.ui.view.rowrepresentable.FilterSectionRow |
|
|
|
@ -26,7 +26,7 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
Session.testInstance(100.0, true, Date(), 1) |
|
|
|
Session.testInstance(100.0, true, Date(), 1) |
|
|
|
realm.commitTransaction() |
|
|
|
realm.commitTransaction() |
|
|
|
|
|
|
|
|
|
|
|
val sessions = Filter.queryOn<Session>(realm, arrayListOf(QueryType.CASH)) |
|
|
|
val sessions = Filter.queryOn<Session>(realm, arrayListOf(QueryCondition.CASH)) |
|
|
|
|
|
|
|
|
|
|
|
Assert.assertEquals(1, sessions.size) |
|
|
|
Assert.assertEquals(1, sessions.size) |
|
|
|
sessions[0]?.run { |
|
|
|
sessions[0]?.run { |
|
|
|
@ -44,7 +44,7 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
Session.testInstance(100.0, true, Date(), 1) |
|
|
|
Session.testInstance(100.0, true, Date(), 1) |
|
|
|
realm.commitTransaction() |
|
|
|
realm.commitTransaction() |
|
|
|
|
|
|
|
|
|
|
|
val sessions = Filter.queryOn<Session>(realm, arrayListOf(QueryType.TOURNAMENT)) |
|
|
|
val sessions = Filter.queryOn<Session>(realm, arrayListOf(QueryCondition.TOURNAMENT)) |
|
|
|
|
|
|
|
|
|
|
|
Assert.assertEquals(1, sessions.size) |
|
|
|
Assert.assertEquals(1, sessions.size) |
|
|
|
sessions[0]?.run { |
|
|
|
sessions[0]?.run { |
|
|
|
@ -67,7 +67,7 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
Session.testInstance(100.0, true, Date(), 1, b2) |
|
|
|
Session.testInstance(100.0, true, Date(), 1, b2) |
|
|
|
realm.commitTransaction() |
|
|
|
realm.commitTransaction() |
|
|
|
|
|
|
|
|
|
|
|
val sessions = Filter.queryOn<Session>(realm, arrayListOf(QueryType.LIVE)) |
|
|
|
val sessions = Filter.queryOn<Session>(realm, arrayListOf(QueryCondition.LIVE)) |
|
|
|
|
|
|
|
|
|
|
|
Assert.assertEquals(1, sessions.size) |
|
|
|
Assert.assertEquals(1, sessions.size) |
|
|
|
(sessions[0] as Session).bankroll?.run { |
|
|
|
(sessions[0] as Session).bankroll?.run { |
|
|
|
@ -89,7 +89,7 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
Session.testInstance(100.0, true, Date(), 1, b2) |
|
|
|
Session.testInstance(100.0, true, Date(), 1, b2) |
|
|
|
realm.commitTransaction() |
|
|
|
realm.commitTransaction() |
|
|
|
|
|
|
|
|
|
|
|
val sessions = Filter.queryOn<Session>(realm, arrayListOf(QueryType.ONLINE)) |
|
|
|
val sessions = Filter.queryOn<Session>(realm, arrayListOf(QueryCondition.ONLINE)) |
|
|
|
|
|
|
|
|
|
|
|
Assert.assertEquals(1, sessions.size) |
|
|
|
Assert.assertEquals(1, sessions.size) |
|
|
|
(sessions[0] as Session).bankroll?.run { |
|
|
|
(sessions[0] as Session).bankroll?.run { |
|
|
|
@ -109,7 +109,7 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
Session.testInstance(bankroll = b2) |
|
|
|
Session.testInstance(bankroll = b2) |
|
|
|
realm.commitTransaction() |
|
|
|
realm.commitTransaction() |
|
|
|
|
|
|
|
|
|
|
|
val filter = QueryType.BANKROLL |
|
|
|
val filter = QueryCondition.BANKROLL |
|
|
|
val filterElementRow = FilterElementRow.Bankroll(b1) |
|
|
|
val filterElementRow = FilterElementRow.Bankroll(b1) |
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.BANKROLL |
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.BANKROLL |
|
|
|
filter.updateValueMap(FilterCondition(filterElementRows = arrayListOf(filterElementRow))) |
|
|
|
filter.updateValueMap(FilterCondition(filterElementRows = arrayListOf(filterElementRow))) |
|
|
|
@ -140,7 +140,7 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
Session.testInstance(bankroll = b3) |
|
|
|
Session.testInstance(bankroll = b3) |
|
|
|
realm.commitTransaction() |
|
|
|
realm.commitTransaction() |
|
|
|
|
|
|
|
|
|
|
|
val filter = QueryType.BANKROLL |
|
|
|
val filter = QueryCondition.BANKROLL |
|
|
|
val filterElementRow = FilterElementRow.Bankroll(b1) |
|
|
|
val filterElementRow = FilterElementRow.Bankroll(b1) |
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.BANKROLL |
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.BANKROLL |
|
|
|
|
|
|
|
|
|
|
|
@ -169,7 +169,7 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
Session.testInstance(game = g2) |
|
|
|
Session.testInstance(game = g2) |
|
|
|
realm.commitTransaction() |
|
|
|
realm.commitTransaction() |
|
|
|
|
|
|
|
|
|
|
|
val filter = QueryType.GAME |
|
|
|
val filter = QueryCondition.GAME |
|
|
|
val filterElementRow = FilterElementRow.Game(g2) |
|
|
|
val filterElementRow = FilterElementRow.Game(g2) |
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.GAME |
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.GAME |
|
|
|
filter.updateValueMap(FilterCondition(filterElementRows = arrayListOf(filterElementRow))) |
|
|
|
filter.updateValueMap(FilterCondition(filterElementRows = arrayListOf(filterElementRow))) |
|
|
|
@ -200,7 +200,7 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
Session.testInstance(game = g3) |
|
|
|
Session.testInstance(game = g3) |
|
|
|
realm.commitTransaction() |
|
|
|
realm.commitTransaction() |
|
|
|
|
|
|
|
|
|
|
|
val filter = QueryType.GAME |
|
|
|
val filter = QueryCondition.GAME |
|
|
|
|
|
|
|
|
|
|
|
val filterElementRow = FilterElementRow.Game(g2) |
|
|
|
val filterElementRow = FilterElementRow.Game(g2) |
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.GAME |
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.GAME |
|
|
|
@ -229,7 +229,7 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
Session.testInstance(location = l2) |
|
|
|
Session.testInstance(location = l2) |
|
|
|
realm.commitTransaction() |
|
|
|
realm.commitTransaction() |
|
|
|
|
|
|
|
|
|
|
|
val filter = QueryType.LOCATION |
|
|
|
val filter = QueryCondition.LOCATION |
|
|
|
val filterElementRow = FilterElementRow.Location(l1) |
|
|
|
val filterElementRow = FilterElementRow.Location(l1) |
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.LOCATION |
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.LOCATION |
|
|
|
filter.updateValueMap(FilterCondition(filterElementRows = arrayListOf(filterElementRow))) |
|
|
|
filter.updateValueMap(FilterCondition(filterElementRows = arrayListOf(filterElementRow))) |
|
|
|
@ -260,7 +260,7 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
Session.testInstance(location = l3) |
|
|
|
Session.testInstance(location = l3) |
|
|
|
realm.commitTransaction() |
|
|
|
realm.commitTransaction() |
|
|
|
|
|
|
|
|
|
|
|
val filter = QueryType.LOCATION |
|
|
|
val filter = QueryCondition.LOCATION |
|
|
|
|
|
|
|
|
|
|
|
val filterElementRow = FilterElementRow.Location(l1) |
|
|
|
val filterElementRow = FilterElementRow.Location(l1) |
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.LOCATION |
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.LOCATION |
|
|
|
@ -290,7 +290,7 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
Session.testInstance(tournamentName = t2) |
|
|
|
Session.testInstance(tournamentName = t2) |
|
|
|
realm.commitTransaction() |
|
|
|
realm.commitTransaction() |
|
|
|
|
|
|
|
|
|
|
|
val filter = QueryType.TOURNAMENT_NAME |
|
|
|
val filter = QueryCondition.TOURNAMENT_NAME |
|
|
|
|
|
|
|
|
|
|
|
val filterElementRow = FilterElementRow.TournamentName(t1) |
|
|
|
val filterElementRow = FilterElementRow.TournamentName(t1) |
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.TOURNAMENT_NAME |
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.TOURNAMENT_NAME |
|
|
|
@ -322,7 +322,7 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
Session.testInstance(tournamentName = t3) |
|
|
|
Session.testInstance(tournamentName = t3) |
|
|
|
realm.commitTransaction() |
|
|
|
realm.commitTransaction() |
|
|
|
|
|
|
|
|
|
|
|
val filter = QueryType.TOURNAMENT_NAME |
|
|
|
val filter = QueryCondition.TOURNAMENT_NAME |
|
|
|
val filterElementRow = FilterElementRow.TournamentName(t1) |
|
|
|
val filterElementRow = FilterElementRow.TournamentName(t1) |
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.TOURNAMENT_NAME |
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.TOURNAMENT_NAME |
|
|
|
val filterElementRow2 = FilterElementRow.TournamentName(t2) |
|
|
|
val filterElementRow2 = FilterElementRow.TournamentName(t2) |
|
|
|
@ -358,7 +358,7 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
Session.testInstance(tournamentFeatures = RealmList(t1)) |
|
|
|
Session.testInstance(tournamentFeatures = RealmList(t1)) |
|
|
|
realm.commitTransaction() |
|
|
|
realm.commitTransaction() |
|
|
|
|
|
|
|
|
|
|
|
val filter = QueryType.ALL_TOURNAMENT_FEATURES |
|
|
|
val filter = QueryCondition.ALL_TOURNAMENT_FEATURES |
|
|
|
val filterElementRow = FilterElementRow.AllTournamentFeature(t1) |
|
|
|
val filterElementRow = FilterElementRow.AllTournamentFeature(t1) |
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.TOURNAMENT_FEATURE |
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.TOURNAMENT_FEATURE |
|
|
|
val filterElementRow2 = FilterElementRow.AllTournamentFeature(t2) |
|
|
|
val filterElementRow2 = FilterElementRow.AllTournamentFeature(t2) |
|
|
|
@ -393,7 +393,7 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
Session.testInstance(tournamentFeatures = RealmList(t1)) |
|
|
|
Session.testInstance(tournamentFeatures = RealmList(t1)) |
|
|
|
realm.commitTransaction() |
|
|
|
realm.commitTransaction() |
|
|
|
|
|
|
|
|
|
|
|
val filter = QueryType.ANY_TOURNAMENT_FEATURES |
|
|
|
val filter = QueryCondition.ANY_TOURNAMENT_FEATURES |
|
|
|
val filterElementRow = FilterElementRow.AnyTournamentFeature(t1) |
|
|
|
val filterElementRow = FilterElementRow.AnyTournamentFeature(t1) |
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.TOURNAMENT_FEATURE |
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.TOURNAMENT_FEATURE |
|
|
|
val filterElementRow2 = FilterElementRow.AnyTournamentFeature(t2) |
|
|
|
val filterElementRow2 = FilterElementRow.AnyTournamentFeature(t2) |
|
|
|
@ -427,7 +427,7 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
Session.testInstance(tournamentFeatures = RealmList(t1)) |
|
|
|
Session.testInstance(tournamentFeatures = RealmList(t1)) |
|
|
|
realm.commitTransaction() |
|
|
|
realm.commitTransaction() |
|
|
|
|
|
|
|
|
|
|
|
val filter = QueryType.ANY_TOURNAMENT_FEATURES |
|
|
|
val filter = QueryCondition.ANY_TOURNAMENT_FEATURES |
|
|
|
val filterElementRow = FilterElementRow.AnyTournamentFeature(t2) |
|
|
|
val filterElementRow = FilterElementRow.AnyTournamentFeature(t2) |
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.TOURNAMENT_FEATURE |
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.TOURNAMENT_FEATURE |
|
|
|
filter.updateValueMap(FilterCondition(filterElementRows = arrayListOf(filterElementRow))) |
|
|
|
filter.updateValueMap(FilterCondition(filterElementRows = arrayListOf(filterElementRow))) |
|
|
|
@ -452,7 +452,7 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
Session.testInstance(tableSize = 10) |
|
|
|
Session.testInstance(tableSize = 10) |
|
|
|
realm.commitTransaction() |
|
|
|
realm.commitTransaction() |
|
|
|
|
|
|
|
|
|
|
|
val filter = QueryType.TABLE_SIZE |
|
|
|
val filter = QueryCondition.TABLE_SIZE |
|
|
|
val filterElementRow = FilterElementRow.TableSize(TableSize(2)) |
|
|
|
val filterElementRow = FilterElementRow.TableSize(TableSize(2)) |
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.TABLE_SIZE |
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.TABLE_SIZE |
|
|
|
val filterElementRow2 = FilterElementRow.TableSize(TableSize(4)) |
|
|
|
val filterElementRow2 = FilterElementRow.TableSize(TableSize(4)) |
|
|
|
@ -479,7 +479,7 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
val s2 = Session.testInstance(netResult = 570.0) |
|
|
|
val s2 = Session.testInstance(netResult = 570.0) |
|
|
|
realm.commitTransaction() |
|
|
|
realm.commitTransaction() |
|
|
|
|
|
|
|
|
|
|
|
val filter = QueryType.MORE_THAN_NET_RESULT |
|
|
|
val filter = QueryCondition.MORE_THAN_NET_RESULT |
|
|
|
val filterElementRow = FilterElementRow.ResultMoreThan(204.0) |
|
|
|
val filterElementRow = FilterElementRow.ResultMoreThan(204.0) |
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.VALUE |
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.VALUE |
|
|
|
filter.updateValueMap(FilterCondition(filterElementRow)) |
|
|
|
filter.updateValueMap(FilterCondition(filterElementRow)) |
|
|
|
@ -504,7 +504,7 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
Session.testInstance(netResult = 570.0) |
|
|
|
Session.testInstance(netResult = 570.0) |
|
|
|
realm.commitTransaction() |
|
|
|
realm.commitTransaction() |
|
|
|
|
|
|
|
|
|
|
|
val filter = QueryType.LESS_THAN_NET_RESULT |
|
|
|
val filter = QueryCondition.LESS_THAN_NET_RESULT |
|
|
|
val filterElementRow = FilterElementRow.ResultLessThan(540.0) |
|
|
|
val filterElementRow = FilterElementRow.ResultLessThan(540.0) |
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.VALUE |
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.VALUE |
|
|
|
filter.updateValueMap(FilterCondition(filterElementRow)) |
|
|
|
filter.updateValueMap(FilterCondition(filterElementRow)) |
|
|
|
@ -529,12 +529,12 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
Session.testInstance(netResult = 570.0) |
|
|
|
Session.testInstance(netResult = 570.0) |
|
|
|
realm.commitTransaction() |
|
|
|
realm.commitTransaction() |
|
|
|
|
|
|
|
|
|
|
|
val filterMore = QueryType.MORE_THAN_NET_RESULT |
|
|
|
val filterMore = QueryCondition.MORE_THAN_NET_RESULT |
|
|
|
val filterElementRow = FilterElementRow.ResultMoreThan(200.0) |
|
|
|
val filterElementRow = FilterElementRow.ResultMoreThan(200.0) |
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.VALUE |
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.VALUE |
|
|
|
filterMore.updateValueMap(FilterCondition(filterElementRow)) |
|
|
|
filterMore.updateValueMap(FilterCondition(filterElementRow)) |
|
|
|
|
|
|
|
|
|
|
|
val filterLess = QueryType.LESS_THAN_NET_RESULT |
|
|
|
val filterLess = QueryCondition.LESS_THAN_NET_RESULT |
|
|
|
val filterElementRow2 = FilterElementRow.ResultLessThan(400.0) |
|
|
|
val filterElementRow2 = FilterElementRow.ResultLessThan(400.0) |
|
|
|
filterElementRow2.filterSectionRow = FilterSectionRow.VALUE |
|
|
|
filterElementRow2.filterSectionRow = FilterSectionRow.VALUE |
|
|
|
filterLess.updateValueMap(FilterCondition(filterElementRow2)) |
|
|
|
filterLess.updateValueMap(FilterCondition(filterElementRow2)) |
|
|
|
|