Conversation
Add tests for silent quota check and configuration fallback behavior.
Corona-Warn-App/src/main/java/de/rki/coronawarnapp/nearby/ENFClient.kt
Outdated
Show resolved
Hide resolved
Corona-Warn-App/src/main/java/de/rki/coronawarnapp/nearby/ENFClient.kt
Outdated
Show resolved
Hide resolved
Corona-Warn-App/src/main/java/de/rki/coronawarnapp/nearby/ENFClientLocalData.kt
Show resolved
Hide resolved
...java/de/rki/coronawarnapp/nearby/modules/diagnosiskeyprovider/DefaultDiagnosisKeyProvider.kt
Outdated
Show resolved
Hide resolved
...java/de/rki/coronawarnapp/nearby/modules/diagnosiskeyprovider/DefaultDiagnosisKeyProvider.kt
Show resolved
Hide resolved
Corona-Warn-App/src/main/java/de/rki/coronawarnapp/worker/DiagnosisKeyRetrievalOneTimeWorker.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall. Commented on some minor code style things.
@Singleton | ||
class TimeStamper @Inject constructor() { | ||
|
||
val nowUTC: Instant |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not consequently used. I'd prefer Instant.now() instead of this helper.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, we should probably also replace all other calls to Instant.now().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we do need this class so that testing is easier and also we can easily fake a timestamp for the whole project
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not "yet" consequently used, when refactoring please make use of this class where possible. It allows us to inject mock time sources in testing and "timetravel" to test edge cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO this can be improved by switching to the ThreeTen time library entirely injecting a Clock - which in turn can be moved in time - instead of using helper functions to solely determine the current time. Anyway, this is a bigger discussion for another time. PR looks fine to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love it.
import com.google.android.gms.nearby.exposurenotification.ExposureConfiguration | ||
import java.io.File | ||
|
||
interface DiagnosisKeyProvider { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this called a provider? this class takes something / "consumes" it and does not provide something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, it's the interface that the class wrapping GoogleENFClient.provideDiagnosisKeys
has to implement. So while it does both, it is more responsible for "providing keys into the ENF" than consuming from our end. 🤔
@Singleton | ||
class TimeStamper @Inject constructor() { | ||
|
||
val nowUTC: Instant |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, we should probably also replace all other calls to Instant.now().
@Singleton | ||
class TimeStamper @Inject constructor() { | ||
|
||
val nowUTC: Instant |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we do need this class so that testing is easier and also we can easily fake a timestamp for the whole project
…o feature/quota-calculator-v2
Kudos, SonarCloud Quality Gate passed! 0 Bugs |
Description
The previous one had to be removed due to unforeseen side-effects in relation to transaction rollbacks.
ENFClient
which currently only has aDiagnosisKeyProvider
module, but will in the future have further modules until the singletonInternalExposureNotificationClient
is empty.How to test
SubmissionQuotaTest
SubmissionQuota
)