| Class | Line # | Actions | |||||
|---|---|---|---|---|---|---|---|
| SuppliersTest | 15 | 4 | 0% | 4 | 0 |
| 1 | package guru.mikelue.foxglove.functional; | |
| 2 | ||
| 3 | import java.util.function.Supplier; | |
| 4 | ||
| 5 | import org.junit.jupiter.api.AfterEach; | |
| 6 | import org.junit.jupiter.api.BeforeEach; | |
| 7 | import org.junit.jupiter.api.Test; | |
| 8 | ||
| 9 | import guru.mikelue.misc.testlib.AbstractTestBase; | |
| 10 | ||
| 11 | import static java.util.concurrent.TimeUnit.SECONDS; | |
| 12 | import static org.assertj.core.api.Assertions.assertThat; | |
| 13 | import static org.awaitility.Awaitility.await; | |
| 14 | ||
| 15 | public class SuppliersTest extends AbstractTestBase { | |
| 16 | 1 | public SuppliersTest() {} |
| 17 | ||
| 18 | 1 | @BeforeEach |
| 19 | void setup() {} | |
| 20 | ||
| 21 | 1 | @AfterEach |
| 22 | void tearDown() {} | |
| 23 | ||
| 24 | /** | |
| 25 | * Tests {@link Suppliers#rollingSupplier(Supplier, int, Object)}. | |
| 26 | */ | |
| 27 | 1 | @Test |
| 28 | void buildRollingSupplier() | |
| 29 | { | |
| 30 | 1 | var testedSupplier = Suppliers.rollingSupplier( |
| 31 | () -> 1, 2, 0 | |
| 32 | ); | |
| 33 | ||
| 34 | 1 | await() |
| 35 | .atMost(5, SECONDS) | |
| 36 | .untilAsserted(() -> { | |
| 37 | 1 | var suppliedValue = testedSupplier.get(); |
| 38 | 1 | assertThat(suppliedValue) |
| 39 | .isEqualTo(0); | |
| 40 | }); | |
| 41 | } | |
| 42 | } |