use of org.springframework.web.context.request.async.DeferredResult.DeferredResultHandler in project spring-framework by spring-projects.
the class DeferredResultTests method hasResult.
@Test
public void hasResult() {
DeferredResultHandler handler = mock(DeferredResultHandler.class);
DeferredResult<String> result = new DeferredResult<>();
result.setResultHandler(handler);
assertFalse(result.hasResult());
assertNull(result.getResult());
result.setResult("hello");
assertEquals("hello", result.getResult());
}
use of org.springframework.web.context.request.async.DeferredResult.DeferredResultHandler in project spring-framework by spring-projects.
the class DeferredResultTests method isSetOrExpired.
@Test
public void isSetOrExpired() {
DeferredResultHandler handler = mock(DeferredResultHandler.class);
DeferredResult<String> result = new DeferredResult<>();
result.setResultHandler(handler);
assertFalse(result.isSetOrExpired());
result.setResult("hello");
assertTrue(result.isSetOrExpired());
verify(handler).handleResult("hello");
}
Aggregations