Skip to content
Permalink
Browse files

Replace `assert()`s with either `require()` or `check()` (#958)

  • Loading branch information...
jmuia committed May 1, 2019
1 parent 2555ad5 commit 645a817ad3bd2e6dfd69b1cf5ab9cbbd2bc43c00
@@ -61,7 +61,7 @@ internal class RealTransacter private constructor(
}

private fun <T> transactionWithRetriesInternal(lambda: (session: Session) -> T): T {
assert(options.maxAttempts > 0)
require(options.maxAttempts > 0)

val backoff = ExponentialBackoff(
Duration.ofMillis(options.minRetryDelayMillis),
@@ -51,7 +51,7 @@ class FakeJobQueue @Inject constructor(
while (true) {
val job = jobs.poll() ?: break
jobHandler.handleJob(job)
assert(job.acknowledged) { "Expected $job to be acknowledged after handling" }
check(job.acknowledged) { "Expected $job to be acknowledged after handling" }
}
}

@@ -119,7 +119,7 @@ internal class FakeJobQueueTest {
val jobs = fakeJobQueue.peekJobs(GREEN_QUEUE)
assertThat(jobs).hasSize(1)

val e = assertFailsWith<AssertionError> {
val e = assertFailsWith<IllegalStateException> {
fakeJobQueue.handleJobs()
}

0 comments on commit 645a817

Please sign in to comment.
You can’t perform that action at this time.