Example usage for java.time Duration ZERO

List of usage examples for java.time Duration ZERO

Introduction

In this page you can find the example usage for java.time Duration ZERO.

Prototype

Duration ZERO

To view the source code for java.time Duration ZERO.

Click Source Link

Document

Constant for a duration of zero.

Usage

From source file:org.springframework.web.server.handler.FilteringWebHandlerTests.java

@Test
public void zeroFilters() throws Exception {

    StubWebHandler targetHandler = new StubWebHandler();

    new FilteringWebHandler(targetHandler, Collections.emptyList())
            .handle(MockServerWebExchange.from(MockServerHttpRequest.get("/"))).block(Duration.ZERO);

    assertTrue(targetHandler.invoked());
}

From source file:org.springframework.web.server.handler.FilteringWebHandlerTests.java

@Test
public void shortcircuitFilter() throws Exception {

    TestFilter filter1 = new TestFilter();
    ShortcircuitingFilter filter2 = new ShortcircuitingFilter();
    TestFilter filter3 = new TestFilter();
    StubWebHandler targetHandler = new StubWebHandler();

    new FilteringWebHandler(targetHandler, Arrays.asList(filter1, filter2, filter3))
            .handle(MockServerWebExchange.from(MockServerHttpRequest.get("/"))).block(Duration.ZERO);

    assertTrue(filter1.invoked());//w  ww .  jav a2 s. c o m
    assertTrue(filter2.invoked());
    assertFalse(filter3.invoked());
    assertFalse(targetHandler.invoked());
}