|
|
|
|
@ -110,7 +110,7 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
|
val filter = QueryCondition.AnyBankroll() |
|
|
|
|
val filterElementRow = QueryCondition.AnyBankroll().apply { setObject(b1) } |
|
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.BANKROLL |
|
|
|
|
filter.updateValueMap(FilterCondition(filterElementRows = arrayListOf(filterElementRow))) |
|
|
|
|
filter.updateValueBy(FilterCondition(filterElementRows = arrayListOf(filterElementRow))) |
|
|
|
|
|
|
|
|
|
val sessions = Filter.queryOn<Session>(realm, arrayListOf(filter)) |
|
|
|
|
|
|
|
|
|
@ -144,7 +144,7 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
|
|
|
|
|
|
val filterElementRow2 = QueryCondition.AnyBankroll().apply { setObject(b2) } |
|
|
|
|
filterElementRow2.filterSectionRow = FilterSectionRow.BANKROLL |
|
|
|
|
filter.updateValueMap(FilterCondition(filterElementRows = arrayListOf(filterElementRow, filterElementRow2))) |
|
|
|
|
filter.updateValueBy(FilterCondition(filterElementRows = arrayListOf(filterElementRow, filterElementRow2))) |
|
|
|
|
|
|
|
|
|
val sessions = Filter.queryOn<Session>(realm, arrayListOf(filter)) |
|
|
|
|
|
|
|
|
|
@ -225,7 +225,7 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
|
val filter = QueryCondition.AnyLocation() |
|
|
|
|
val filterElementRow = QueryCondition.AnyLocation().apply { setObject(l1) } |
|
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.LOCATION |
|
|
|
|
filter.updateValueMap(FilterCondition(filterElementRows = arrayListOf(filterElementRow))) |
|
|
|
|
filter.updateValueBy(FilterCondition(filterElementRows = arrayListOf(filterElementRow))) |
|
|
|
|
|
|
|
|
|
val sessions = Filter.queryOn<Session>(realm, arrayListOf(filter)) |
|
|
|
|
|
|
|
|
|
@ -260,7 +260,7 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
|
val filterElementRow2 = QueryCondition.AnyLocation().apply { setObject(l3) } |
|
|
|
|
filterElementRow2.filterSectionRow = FilterSectionRow.LOCATION |
|
|
|
|
|
|
|
|
|
filter.updateValueMap(FilterCondition(filterElementRows = arrayListOf(filterElementRow, filterElementRow2))) |
|
|
|
|
filter.updateValueBy(FilterCondition(filterElementRows = arrayListOf(filterElementRow, filterElementRow2))) |
|
|
|
|
|
|
|
|
|
val sessions = Filter.queryOn<Session>(realm, arrayListOf(filter)) |
|
|
|
|
|
|
|
|
|
@ -287,7 +287,7 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
|
|
|
|
|
|
val filterElementRow = QueryCondition.AnyTournamentName().apply { setObject(t1) } |
|
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.TOURNAMENT_NAME |
|
|
|
|
filter.updateValueMap(FilterCondition(filterElementRows = arrayListOf(filterElementRow))) |
|
|
|
|
filter.updateValueBy(FilterCondition(filterElementRows = arrayListOf(filterElementRow))) |
|
|
|
|
|
|
|
|
|
val sessions = Filter.queryOn<Session>(realm, arrayListOf(filter)) |
|
|
|
|
|
|
|
|
|
@ -320,7 +320,7 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.TOURNAMENT_NAME |
|
|
|
|
val filterElementRow2 = QueryCondition.AnyTournamentName().apply { setObject(t2) } |
|
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.TOURNAMENT_NAME |
|
|
|
|
filter.updateValueMap(FilterCondition(filterElementRows = arrayListOf(filterElementRow, filterElementRow2))) |
|
|
|
|
filter.updateValueBy(FilterCondition(filterElementRows = arrayListOf(filterElementRow, filterElementRow2))) |
|
|
|
|
|
|
|
|
|
val sessions = Filter.queryOn<Session>(realm, arrayListOf(filter)) |
|
|
|
|
|
|
|
|
|
@ -358,7 +358,7 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
|
filterElementRow2.filterSectionRow = FilterSectionRow.TOURNAMENT_FEATURE |
|
|
|
|
val filterElementRow3 = QueryCondition.AllTournamentFeature().apply { setObject(t4) } |
|
|
|
|
filterElementRow3.filterSectionRow = FilterSectionRow.TOURNAMENT_FEATURE |
|
|
|
|
filter.updateValueMap(FilterCondition(filterElementRows = arrayListOf(filterElementRow, filterElementRow2, filterElementRow3))) |
|
|
|
|
filter.updateValueBy(FilterCondition(filterElementRows = arrayListOf(filterElementRow, filterElementRow2, filterElementRow3))) |
|
|
|
|
|
|
|
|
|
val sessions = Filter.queryOn<Session>(realm, arrayListOf(filter)) |
|
|
|
|
|
|
|
|
|
@ -395,7 +395,7 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
|
filterElementRow3.filterSectionRow = FilterSectionRow.TOURNAMENT_FEATURE |
|
|
|
|
val filterElementRow4 = QueryCondition.AnyTournamentFeature().apply { setObject(t4) } |
|
|
|
|
filterElementRow4.filterSectionRow = FilterSectionRow.TOURNAMENT_FEATURE |
|
|
|
|
filter.updateValueMap(FilterCondition(filterElementRows = arrayListOf(filterElementRow, filterElementRow2, filterElementRow3, filterElementRow4))) |
|
|
|
|
filter.updateValueBy(FilterCondition(filterElementRows = arrayListOf(filterElementRow, filterElementRow2, filterElementRow3, filterElementRow4))) |
|
|
|
|
|
|
|
|
|
val sessions = Filter.queryOn<Session>(realm, arrayListOf(filter)) |
|
|
|
|
|
|
|
|
|
@ -423,7 +423,7 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
|
val filter = QueryCondition.AnyTournamentFeature() |
|
|
|
|
val filterElementRow = QueryCondition.AnyTournamentFeature().apply { setObject(t2) } |
|
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.TOURNAMENT_FEATURE |
|
|
|
|
filter.updateValueMap(FilterCondition(filterElementRows = arrayListOf(filterElementRow))) |
|
|
|
|
filter.updateValueBy(FilterCondition(filterElementRows = arrayListOf(filterElementRow))) |
|
|
|
|
|
|
|
|
|
val sessions = Filter.queryOn<Session>(realm, arrayListOf(filter)) |
|
|
|
|
|
|
|
|
|
@ -450,7 +450,7 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.TABLE_SIZE |
|
|
|
|
val filterElementRow2 = QueryCondition.AnyTableSize().apply { listOfValues = arrayListOf(4) } |
|
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.TABLE_SIZE |
|
|
|
|
filter.updateValueMap(FilterCondition(filterElementRows = arrayListOf(filterElementRow, filterElementRow2))) |
|
|
|
|
filter.updateValueBy(FilterCondition(filterElementRows = arrayListOf(filterElementRow, filterElementRow2))) |
|
|
|
|
|
|
|
|
|
val sessions = Filter.queryOn<Session>(realm, arrayListOf(filter)) |
|
|
|
|
|
|
|
|
|
@ -475,7 +475,7 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
|
val filter = QueryCondition.NetAmountWon() |
|
|
|
|
val filterElementRow = QueryCondition.more<QueryCondition.NetAmountWon>().apply { listOfValues = arrayListOf(204.0) } |
|
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.VALUE |
|
|
|
|
filter.updateValueMap(FilterCondition(arrayListOf(filterElementRow))) |
|
|
|
|
filter.updateValueBy(FilterCondition(arrayListOf(filterElementRow))) |
|
|
|
|
|
|
|
|
|
val sessions = Filter.queryOn<Session>(realm, arrayListOf(filterElementRow)) |
|
|
|
|
|
|
|
|
|
@ -500,7 +500,7 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
|
val filter = QueryCondition.NetAmountWon() |
|
|
|
|
val filterElementRow = QueryCondition.less<QueryCondition.NetAmountWon>().apply { listOfValues = arrayListOf(540.0) } |
|
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.VALUE |
|
|
|
|
filter.updateValueMap(FilterCondition(arrayListOf(filterElementRow))) |
|
|
|
|
filter.updateValueBy(FilterCondition(arrayListOf(filterElementRow))) |
|
|
|
|
|
|
|
|
|
val sessions = Filter.queryOn<Session>(realm, arrayListOf(filter)) |
|
|
|
|
|
|
|
|
|
@ -525,12 +525,12 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
|
val filterMore = QueryCondition.NetAmountWon() |
|
|
|
|
val filterElementRow = QueryCondition.more<QueryCondition.NetAmountWon>().apply { listOfValues = arrayListOf(200.0) } |
|
|
|
|
filterElementRow.filterSectionRow = FilterSectionRow.VALUE |
|
|
|
|
filterMore.updateValueMap(FilterCondition(arrayListOf(filterElementRow))) |
|
|
|
|
filterMore.updateValueBy(FilterCondition(arrayListOf(filterElementRow))) |
|
|
|
|
|
|
|
|
|
val filterLess = QueryCondition.NetAmountWon() |
|
|
|
|
val filterElementRow2 = QueryCondition.less<QueryCondition.NetAmountWon>().apply { listOfValues = arrayListOf(400.0) } |
|
|
|
|
filterElementRow2.filterSectionRow = FilterSectionRow.VALUE |
|
|
|
|
filterLess.updateValueMap(FilterCondition(arrayListOf(filterElementRow2))) |
|
|
|
|
filterLess.updateValueBy(FilterCondition(arrayListOf(filterElementRow2))) |
|
|
|
|
|
|
|
|
|
val sessions = Filter.queryOn<Session>(realm, arrayListOf(filterMore, filterLess)) |
|
|
|
|
|
|
|
|
|
@ -573,4 +573,44 @@ class SessionFilterInstrumentedUnitTest : BaseFilterInstrumentedUnitTest() { |
|
|
|
|
Assert.assertTrue(result.contains((it as Session).id)) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
fun testTournamentFinalPosition() { |
|
|
|
|
val realm = this.mockRealm |
|
|
|
|
realm.beginTransaction() |
|
|
|
|
val s1 = Session.testInstance(netResult = 200.0, isTournament = true) |
|
|
|
|
s1.result!!.tournamentFinalPosition = 5 |
|
|
|
|
|
|
|
|
|
val s2 = Session.testInstance(netResult = 50.0, isTournament = true) |
|
|
|
|
s2.result!!.tournamentFinalPosition = 15 |
|
|
|
|
|
|
|
|
|
val s3 = Session.testInstance(netResult = 500.0, isTournament = true) |
|
|
|
|
s3.result!!.tournamentFinalPosition = 2 |
|
|
|
|
|
|
|
|
|
val s4 = Session.testInstance(netResult = 570.0, isTournament = true) |
|
|
|
|
s4.result!!.tournamentFinalPosition = 1 |
|
|
|
|
realm.commitTransaction() |
|
|
|
|
|
|
|
|
|
val filterLess = QueryCondition.TournamentFinalPosition(QueryCondition.Operator.LESS, finalPosition = 1) |
|
|
|
|
var sessions = Filter.queryOn<Session>(realm, arrayListOf(filterLess)) |
|
|
|
|
|
|
|
|
|
Assert.assertEquals(1, sessions.size) |
|
|
|
|
|
|
|
|
|
var result = arrayListOf(s4.id) |
|
|
|
|
sessions.forEach { |
|
|
|
|
Assert.assertTrue(result.contains((it as Session).id)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val filterMore = QueryCondition.TournamentFinalPosition(QueryCondition.Operator.MORE, finalPosition = 10) |
|
|
|
|
sessions = Filter.queryOn<Session>(realm, arrayListOf(filterMore)) |
|
|
|
|
|
|
|
|
|
Assert.assertEquals(1, sessions.size) |
|
|
|
|
|
|
|
|
|
result = arrayListOf(s2.id) |
|
|
|
|
sessions.forEach { |
|
|
|
|
Assert.assertTrue(result.contains((it as Session).id)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |