Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
SSSDNSY
spring-framework
提交
5e1e29a2
S
spring-framework
项目概览
SSSDNSY
/
spring-framework
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5e1e29a2
编写于
3月 31, 2021
作者:
R
Rossen Stoyanchev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix failing tests
See gh-26746
上级
7dc3a556
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
25 addition
and
14 deletion
+25
-14
spring-core/src/testFixtures/java/org/springframework/core/testfixture/io/buffer/AbstractDataBufferAllocatingTests.java
...tfixture/io/buffer/AbstractDataBufferAllocatingTests.java
+7
-2
spring-web/src/test/java/org/springframework/http/codec/ServerSentEventHttpMessageWriterTests.java
...ork/http/codec/ServerSentEventHttpMessageWriterTests.java
+18
-12
未找到文件。
spring-core/src/testFixtures/java/org/springframework/core/testfixture/io/buffer/AbstractDataBufferAllocatingTests.java
浏览文件 @
5e1e29a2
/*
* Copyright 2002-202
0
the original author or authors.
* Copyright 2002-202
1
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.
...
...
@@ -20,6 +20,7 @@ import java.lang.annotation.ElementType;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
import
java.nio.charset.Charset
;
import
java.nio.charset.StandardCharsets
;
import
java.time.Duration
;
import
java.time.Instant
;
...
...
@@ -89,8 +90,12 @@ public abstract class AbstractDataBufferAllocatingTests {
}
protected
Consumer
<
DataBuffer
>
stringConsumer
(
String
expected
)
{
return
stringConsumer
(
expected
,
UTF_8
);
}
protected
Consumer
<
DataBuffer
>
stringConsumer
(
String
expected
,
Charset
charset
)
{
return
dataBuffer
->
{
String
value
=
dataBuffer
.
toString
(
UTF_8
);
String
value
=
dataBuffer
.
toString
(
charset
);
DataBufferUtils
.
release
(
dataBuffer
);
assertThat
(
value
).
isEqualTo
(
expected
);
};
...
...
spring-web/src/test/java/org/springframework/http/codec/ServerSentEventHttpMessageWriterTests.java
浏览文件 @
5e1e29a2
/*
* Copyright 2002-202
0
the original author or authors.
* Copyright 2002-202
1
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.
...
...
@@ -150,8 +150,12 @@ class ServerSentEventHttpMessageWriterTests extends AbstractDataBufferAllocating
testWrite
(
source
,
outputMessage
,
Pojo
.
class
);
StepVerifier
.
create
(
outputMessage
.
getBody
())
.
consumeNextWith
(
stringConsumer
(
"data:{\"foo\":\"foofoo\",\"bar\":\"barbar\"}\n\n"
))
.
consumeNextWith
(
stringConsumer
(
"data:{\"foo\":\"foofoofoo\",\"bar\":\"barbarbar\"}\n\n"
))
.
consumeNextWith
(
stringConsumer
(
"data:"
))
.
consumeNextWith
(
stringConsumer
(
"{\"foo\":\"foofoo\",\"bar\":\"barbar\"}"
))
.
consumeNextWith
(
stringConsumer
(
"\n\n"
))
.
consumeNextWith
(
stringConsumer
(
"data:"
))
.
consumeNextWith
(
stringConsumer
(
"{\"foo\":\"foofoofoo\",\"bar\":\"barbarbar\"}"
))
.
consumeNextWith
(
stringConsumer
(
"\n\n"
))
.
expectComplete
()
.
verify
();
}
...
...
@@ -168,12 +172,16 @@ class ServerSentEventHttpMessageWriterTests extends AbstractDataBufferAllocating
testWrite
(
source
,
outputMessage
,
Pojo
.
class
);
StepVerifier
.
create
(
outputMessage
.
getBody
())
.
consumeNextWith
(
stringConsumer
(
"data:{\n"
+
.
consumeNextWith
(
stringConsumer
(
"data:"
))
.
consumeNextWith
(
stringConsumer
(
"{\n"
+
"data: \"foo\" : \"foofoo\",\n"
+
"data: \"bar\" : \"barbar\"\n"
+
"data:}\n\n"
))
.
consumeNextWith
(
stringConsumer
(
"data:{\n"
+
"data: \"bar\" : \"barbar\"\n"
+
"data:}"
))
.
consumeNextWith
(
stringConsumer
(
"\n\n"
))
.
consumeNextWith
(
stringConsumer
(
"data:"
))
.
consumeNextWith
(
stringConsumer
(
"{\n"
+
"data: \"foo\" : \"foofoofoo\",\n"
+
"data: \"bar\" : \"barbarbar\"\n"
+
"data:}\n\n"
))
"data: \"bar\" : \"barbarbar\"\n"
+
"data:}"
))
.
consumeNextWith
(
stringConsumer
(
"\n\n"
))
.
expectComplete
()
.
verify
();
}
...
...
@@ -190,11 +198,9 @@ class ServerSentEventHttpMessageWriterTests extends AbstractDataBufferAllocating
assertThat
(
outputMessage
.
getHeaders
().
getContentType
()).
isEqualTo
(
mediaType
);
StepVerifier
.
create
(
outputMessage
.
getBody
())
.
consumeNextWith
(
dataBuffer
->
{
String
value
=
dataBuffer
.
toString
(
charset
);
DataBufferUtils
.
release
(
dataBuffer
);
assertThat
(
value
).
isEqualTo
(
"data:{\"foo\":\"foo\uD834\uDD1E\",\"bar\":\"bar\uD834\uDD1E\"}\n\n"
);
})
.
consumeNextWith
(
stringConsumer
(
"data:"
,
charset
))
.
consumeNextWith
(
stringConsumer
(
"{\"foo\":\"foo\uD834\uDD1E\",\"bar\":\"bar\uD834\uDD1E\"}"
,
charset
))
.
consumeNextWith
(
stringConsumer
(
"\n\n"
,
charset
))
.
expectComplete
()
.
verify
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录