Skip to content

Commit

Permalink
oops, this should be added too
Browse files Browse the repository at this point in the history
  • Loading branch information
iNoles committed Jun 22, 2024
1 parent ff56e16 commit 5c156c0
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions fuel/src/jvmTest/kotlin/fuel/HttpLoaderFactoryTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package fuel

import org.junit.Assert.assertFalse
import java.util.concurrent.atomic.AtomicBoolean
import kotlin.test.Test

class HttpLoaderFactoryTest {
@Test
fun test_checkHttpLoaderInvokedOnce() {
val httpLoader = FuelBuilder().build()

val isInitialized = AtomicBoolean(false)
Fuel.setHttpLoader {
check(!isInitialized.getAndSet(true)) { "newHttpLoader was invoked more than once." }
httpLoader
}

assertFalse(isInitialized.get())
}
}

0 comments on commit 5c156c0

Please sign in to comment.