Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Cwa App Android
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Felix Foertsch
Cwa App Android
Commits
f4b4595b
Commit
f4b4595b
authored
4 years ago
by
d067928
Browse files
Options
Downloads
Patches
Plain Diff
Adapt QuotaCalculatorTest to old JUnit4 API
Signed-off-by:
d067928
<
jakob.moeller@sap.com
>
parent
d5ffa3ca
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Corona-Warn-App/src/test/java/de/rki/coronawarnapp/util/GoogleQuotaCalculatorTest.kt
+11
-17
11 additions, 17 deletions
...va/de/rki/coronawarnapp/util/GoogleQuotaCalculatorTest.kt
with
11 additions
and
17 deletions
Corona-Warn-App/src/test/java/de/rki/coronawarnapp/util/GoogleQuotaCalculatorTest.kt
+
11
−
17
View file @
f4b4595b
...
...
@@ -10,17 +10,15 @@ import org.joda.time.DateTimeZone
import
org.joda.time.Duration
import
org.joda.time.Instant
import
org.joda.time.chrono.GJChronology
import
org.junit.jupiter.api.AfterEach
import
org.junit.jupiter.api.Assertions.assertEquals
import
org.junit.jupiter.api.BeforeEach
import
org.junit.jupiter.api.Test
import
org.junit.jupiter.api.assertThrows
import
testhelpers.BaseTest
import
org.junit.After
import
org.junit.Assert.assertEquals
import
org.junit.Before
import
org.junit.Test
import
timber.log.Timber
import
java.util.concurrent.atomic.AtomicInteger
import
java.util.concurrent.atomic.AtomicLong
internal
class
GoogleQuotaCalculatorTest
:
BaseTest
()
{
internal
class
GoogleQuotaCalculatorTest
{
private
val
timeInTest
=
DateTimeUtils
.
currentTimeMillis
()
...
...
@@ -31,7 +29,7 @@ internal class GoogleQuotaCalculatorTest : BaseTest() {
private
val
defaultIncrementByAmountInTest
=
14
private
val
defaultQuotaLimitInTest
=
20
@Before
Each
@Before
fun
setUpClassUnderTest
()
{
classUnderTest
=
GoogleQuotaCalculator
(
incrementByAmount
=
defaultIncrementByAmountInTest
,
...
...
@@ -127,7 +125,7 @@ internal class GoogleQuotaCalculatorTest : BaseTest() {
assertEquals
(
false
,
classUnderTest
.
hasExceededQuota
)
}
@Test
@Test
(
expected
=
IllegalArgumentException
::
class
)
fun
`getProgressTowardsQuota
is
reset
but
the
reset
value
is
no
multiple
of
incrementByAmount`
()
{
var
latestCallNumberWithoutLimiting
=
1
for
(
callNumber
in
1
..
5
)
{
...
...
@@ -149,9 +147,7 @@ internal class GoogleQuotaCalculatorTest : BaseTest() {
}
}
assertThrows
<
IllegalArgumentException
>
{
classUnderTest
.
resetProgressTowardsQuota
(
defaultIncrementByAmountInTest
+
1
)
}
classUnderTest
.
resetProgressTowardsQuota
(
defaultIncrementByAmountInTest
+
1
)
}
@Test
...
...
@@ -182,7 +178,7 @@ internal class GoogleQuotaCalculatorTest : BaseTest() {
assertEquals
(
newProgressAfterReset
,
classUnderTest
.
getProgressTowardsQuota
())
}
@Test
@Test
(
expected
=
IllegalArgumentException
::
class
)
fun
`getProgressTowardsQuota
is
reset
and
the
quota
is
not
recalculated
and
the
progress
throws
an
error
because
of
too
high
newProgress`
()
{
var
latestCallNumberWithoutLimiting
=
1
var
progressBeforeReset
:
Int
?
=
null
...
...
@@ -208,9 +204,7 @@ internal class GoogleQuotaCalculatorTest : BaseTest() {
}
val
newProgressAfterReset
=
defaultQuotaLimitInTest
+
1
assertThrows
<
IllegalArgumentException
>
{
classUnderTest
.
resetProgressTowardsQuota
(
newProgressAfterReset
)
}
classUnderTest
.
resetProgressTowardsQuota
(
newProgressAfterReset
)
assertEquals
(
true
,
classUnderTest
.
hasExceededQuota
)
assertEquals
(
(
progressBeforeReset
...
...
@@ -287,7 +281,7 @@ internal class GoogleQuotaCalculatorTest : BaseTest() {
}
@After
Each
@After
fun
cleanup
()
{
DateTimeUtils
.
setCurrentMillisSystem
()
unmockkObject
(
LocalData
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment