25 lines
770 B
Java
25 lines
770 B
Java
package tech.easyflow.manuagent.common;
|
|
|
|
import static org.assertj.core.api.Assertions.assertThatCode;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
import org.springframework.web.context.request.async.AsyncRequestNotUsableException;
|
|
|
|
/**
|
|
* 验证统一异常边界对流式连接终止的处理。
|
|
*/
|
|
class GlobalExceptionHandlerTest {
|
|
|
|
/**
|
|
* 客户端断开已提交的流式响应时不再尝试写入 JSON 错误体。
|
|
*/
|
|
@Test
|
|
void shouldIgnoreExpectedStreamDisconnect() {
|
|
GlobalExceptionHandler handler = new GlobalExceptionHandler();
|
|
|
|
assertThatCode(() -> handler.handleClientDisconnect(
|
|
new AsyncRequestNotUsableException("ServletOutputStream failed to flush")))
|
|
.doesNotThrowAnyException();
|
|
}
|
|
}
|