Polishing in WebAsyncManager

See gh-34192
This commit is contained in:
rstoyanchev
2025-01-02 13:32:41 +00:00
parent 181db1db75
commit 5a44897c55
4 changed files with 107 additions and 97 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -93,7 +93,7 @@ class DeferredResultTests {
DeferredResult<String> result = new DeferredResult<>();
result.onCompletion(() -> sb.append("completion event"));
result.getInterceptor().afterCompletion(null, null);
result.getLifecycleInterceptor().afterCompletion(null, null);
assertThat(result.isSetOrExpired()).isTrue();
assertThat(sb.toString()).isEqualTo("completion event");
@@ -109,7 +109,7 @@ class DeferredResultTests {
result.setResultHandler(handler);
result.onTimeout(() -> sb.append("timeout event"));
result.getInterceptor().handleTimeout(null, null);
result.getLifecycleInterceptor().handleTimeout(null, null);
assertThat(sb.toString()).isEqualTo("timeout event");
assertThat(result.setResult("hello")).as("Should not be able to set result a second time").isFalse();
@@ -127,7 +127,7 @@ class DeferredResultTests {
Exception e = new Exception();
result.onError(t -> sb.append("error event"));
result.getInterceptor().handleError(null, null, e);
result.getLifecycleInterceptor().handleError(null, null, e);
assertThat(sb.toString()).isEqualTo("error event");
assertThat(result.setResult("hello")).as("Should not be able to set result a second time").isFalse();