Quiz

May Quiz

Consider the following scenario for the given JUnit 5 test case: the orderService.book(...) method instantly returns null and isServerEnvironment() returns false. Which of the following statements is true:

 

import static org.junit.jupiter.api.Assertions.assertTimeout;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
//...
public class OrderTest {
    //...
    @Test
    public void testServiceTimeout() {
        assumeTrue(isServerEnvironment());
        assertTimeout(
            ofMillis(5),
            () -> orderService.book("product-id", 5, "user-id"));
    }
}



Which of the following statements is correct:






progress bar illustration

    Q1

    Q2

    Q3

    Q4