Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sesemomo
spring-framework
提交
8705df50
S
spring-framework
项目概览
sesemomo
/
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,发现更多精彩内容 >>
提交
8705df50
编写于
11月 02, 2016
作者:
S
Sebastien Deleuze
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename Verifier to StepVerifier
Issue: SPR-14800
上级
bb0d4c8c
变更
48
隐藏空白更改
内联
并排
Showing
48 changed file
with
203 addition
and
204 deletion
+203
-204
spring-core/src/test/java/org/springframework/core/codec/ByteArrayDecoderTests.java
...org/springframework/core/codec/ByteArrayDecoderTests.java
+2
-2
spring-core/src/test/java/org/springframework/core/codec/ByteArrayEncoderTests.java
...org/springframework/core/codec/ByteArrayEncoderTests.java
+2
-2
spring-core/src/test/java/org/springframework/core/codec/ByteBufferDecoderTests.java
...rg/springframework/core/codec/ByteBufferDecoderTests.java
+2
-2
spring-core/src/test/java/org/springframework/core/codec/ByteBufferEncoderTests.java
...rg/springframework/core/codec/ByteBufferEncoderTests.java
+2
-2
spring-core/src/test/java/org/springframework/core/codec/CharSequenceEncoderTests.java
.../springframework/core/codec/CharSequenceEncoderTests.java
+3
-3
spring-core/src/test/java/org/springframework/core/codec/ResourceDecoderTests.java
.../org/springframework/core/codec/ResourceDecoderTests.java
+2
-2
spring-core/src/test/java/org/springframework/core/codec/ResourceEncoderTests.java
.../org/springframework/core/codec/ResourceEncoderTests.java
+2
-2
spring-core/src/test/java/org/springframework/core/codec/ResourceRegionEncoderTests.java
...pringframework/core/codec/ResourceRegionEncoderTests.java
+3
-3
spring-core/src/test/java/org/springframework/core/codec/StringDecoderTests.java
...va/org/springframework/core/codec/StringDecoderTests.java
+7
-7
spring-core/src/test/java/org/springframework/core/io/buffer/DataBufferUtilsTests.java
.../springframework/core/io/buffer/DataBufferUtilsTests.java
+7
-7
spring-web-reactive/src/test/java/org/springframework/web/reactive/DispatcherHandlerErrorTests.java
...ngframework/web/reactive/DispatcherHandlerErrorTests.java
+8
-8
spring-web-reactive/src/test/java/org/springframework/web/reactive/config/ResourceHandlerRegistryTests.java
...ork/web/reactive/config/ResourceHandlerRegistryTests.java
+2
-2
spring-web-reactive/src/test/java/org/springframework/web/reactive/function/SseHandlerFunctionIntegrationTests.java
...reactive/function/SseHandlerFunctionIntegrationTests.java
+4
-4
spring-web-reactive/src/test/java/org/springframework/web/reactive/resource/ResourceWebHandlerTests.java
...mework/web/reactive/resource/ResourceWebHandlerTests.java
+4
-4
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/HandlerMethodMappingTests.java
...web/reactive/result/method/HandlerMethodMappingTests.java
+2
-2
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/InvocableHandlerMethodTests.java
...b/reactive/result/method/InvocableHandlerMethodTests.java
+6
-6
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/RequestMappingInfoHandlerMappingTests.java
.../result/method/RequestMappingInfoHandlerMappingTests.java
+3
-3
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/CookieValueMethodArgumentResolverTests.java
...od/annotation/CookieValueMethodArgumentResolverTests.java
+2
-2
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/HttpEntityArgumentResolverTests.java
...lt/method/annotation/HttpEntityArgumentResolverTests.java
+10
-10
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/MessageReaderArgumentResolverTests.java
...method/annotation/MessageReaderArgumentResolverTests.java
+5
-5
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/MessageWriterResultHandlerTests.java
...lt/method/annotation/MessageWriterResultHandlerTests.java
+3
-3
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/PathVariableMethodArgumentResolverTests.java
...d/annotation/PathVariableMethodArgumentResolverTests.java
+4
-5
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestAttributeMethodArgumentResolverTests.java
...notation/RequestAttributeMethodArgumentResolverTests.java
+2
-2
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestBodyArgumentResolverTests.java
...t/method/annotation/RequestBodyArgumentResolverTests.java
+11
-11
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestHeaderMethodArgumentResolverTests.java
.../annotation/RequestHeaderMethodArgumentResolverTests.java
+2
-2
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestParamMethodArgumentResolverTests.java
...d/annotation/RequestParamMethodArgumentResolverTests.java
+2
-2
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ResponseEntityResultHandlerTests.java
...t/method/annotation/ResponseEntityResultHandlerTests.java
+2
-2
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/SessionAttributeMethodArgumentResolverTests.java
...notation/SessionAttributeMethodArgumentResolverTests.java
+2
-2
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/SseIntegrationTests.java
...eactive/result/method/annotation/SseIntegrationTests.java
+5
-5
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/view/HttpMessageWriterViewTests.java
.../web/reactive/result/view/HttpMessageWriterViewTests.java
+2
-2
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandlerTests.java
...eactive/result/view/ViewResolutionResultHandlerTests.java
+4
-4
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/view/freemarker/FreeMarkerViewTests.java
.../reactive/result/view/freemarker/FreeMarkerViewTests.java
+2
-2
spring-web/src/test/java/org/springframework/http/codec/BodyExtractorsTests.java
...a/org/springframework/http/codec/BodyExtractorsTests.java
+4
-4
spring-web/src/test/java/org/springframework/http/codec/BodyInsertersTests.java
...va/org/springframework/http/codec/BodyInsertersTests.java
+9
-9
spring-web/src/test/java/org/springframework/http/codec/EncoderHttpMessageWriterTest.java
...ingframework/http/codec/EncoderHttpMessageWriterTest.java
+2
-2
spring-web/src/test/java/org/springframework/http/codec/ResourceHttpMessageWriterTests.java
...gframework/http/codec/ResourceHttpMessageWriterTests.java
+6
-6
spring-web/src/test/java/org/springframework/http/codec/ResourceRegionHttpMessageWriterTests.java
...work/http/codec/ResourceRegionHttpMessageWriterTests.java
+5
-5
spring-web/src/test/java/org/springframework/http/codec/ServerSentEventHttpMessageWriterTests.java
...ork/http/codec/ServerSentEventHttpMessageWriterTests.java
+6
-6
spring-web/src/test/java/org/springframework/http/codec/json/Jackson2JsonDecoderTests.java
...ngframework/http/codec/json/Jackson2JsonDecoderTests.java
+6
-6
spring-web/src/test/java/org/springframework/http/codec/json/Jackson2JsonEncoderTests.java
...ngframework/http/codec/json/Jackson2JsonEncoderTests.java
+4
-4
spring-web/src/test/java/org/springframework/http/codec/json/JsonObjectDecoderTests.java
...ringframework/http/codec/json/JsonObjectDecoderTests.java
+7
-7
spring-web/src/test/java/org/springframework/http/codec/xml/Jaxb2XmlDecoderTests.java
.../springframework/http/codec/xml/Jaxb2XmlDecoderTests.java
+7
-7
spring-web/src/test/java/org/springframework/http/codec/xml/Jaxb2XmlEncoderTests.java
.../springframework/http/codec/xml/Jaxb2XmlEncoderTests.java
+2
-2
spring-web/src/test/java/org/springframework/http/codec/xml/XmlEventDecoderTests.java
.../springframework/http/codec/xml/XmlEventDecoderTests.java
+3
-3
spring-web/src/test/java/org/springframework/http/server/reactive/FlushingIntegrationTests.java
...mework/http/server/reactive/FlushingIntegrationTests.java
+2
-2
spring-web/src/test/java/org/springframework/web/client/reactive/ExchangeFilterFunctionsTests.java
...ork/web/client/reactive/ExchangeFilterFunctionsTests.java
+5
-5
spring-web/src/test/java/org/springframework/web/client/reactive/WebClientIntegrationTests.java
...mework/web/client/reactive/WebClientIntegrationTests.java
+14
-14
spring-web/src/test/java/org/springframework/web/server/handler/ResponseStatusExceptionHandlerTests.java
...b/server/handler/ResponseStatusExceptionHandlerTests.java
+2
-2
未找到文件。
spring-core/src/test/java/org/springframework/core/codec/ByteArrayDecoderTests.java
浏览文件 @
8705df50
...
...
@@ -21,7 +21,7 @@ import java.util.Collections;
import
org.junit.Test
;
import
org.reactivestreams.Publisher
;
import
reactor.core.publisher.Flux
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.core.ResolvableType
;
import
org.springframework.core.io.buffer.AbstractDataBufferAllocatingTestCase
;
...
...
@@ -58,7 +58,7 @@ public class ByteArrayDecoderTests extends AbstractDataBufferAllocatingTestCase
ResolvableType
.
forClassWithGenerics
(
Publisher
.
class
,
byte
[].
class
),
null
,
Collections
.
emptyMap
());
Verifier
.
create
(
output
)
Step
Verifier
.
create
(
output
)
.
consumeNextWith
(
bytes
->
assertArrayEquals
(
"foo"
.
getBytes
(),
bytes
))
.
consumeNextWith
(
bytes
->
assertArrayEquals
(
"bar"
.
getBytes
(),
bytes
))
.
expectComplete
()
...
...
spring-core/src/test/java/org/springframework/core/codec/ByteArrayEncoderTests.java
浏览文件 @
8705df50
...
...
@@ -24,7 +24,7 @@ import org.junit.Before;
import
org.junit.Test
;
import
org.reactivestreams.Publisher
;
import
reactor.core.publisher.Flux
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.core.ResolvableType
;
import
org.springframework.core.io.buffer.AbstractDataBufferAllocatingTestCase
;
...
...
@@ -67,7 +67,7 @@ public class ByteArrayEncoderTests extends AbstractDataBufferAllocatingTestCase
ResolvableType
.
forClassWithGenerics
(
Publisher
.
class
,
ByteBuffer
.
class
),
null
,
Collections
.
emptyMap
());
Verifier
.
create
(
output
)
Step
Verifier
.
create
(
output
)
.
consumeNextWith
(
b
->
{
byte
[]
buf
=
new
byte
[
3
];
b
.
read
(
buf
);
...
...
spring-core/src/test/java/org/springframework/core/codec/ByteBufferDecoderTests.java
浏览文件 @
8705df50
...
...
@@ -22,7 +22,7 @@ import java.util.Collections;
import
org.junit.Test
;
import
org.reactivestreams.Publisher
;
import
reactor.core.publisher.Flux
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.core.ResolvableType
;
import
org.springframework.core.io.buffer.AbstractDataBufferAllocatingTestCase
;
...
...
@@ -58,7 +58,7 @@ public class ByteBufferDecoderTests extends AbstractDataBufferAllocatingTestCase
ResolvableType
.
forClassWithGenerics
(
Publisher
.
class
,
ByteBuffer
.
class
),
null
,
Collections
.
emptyMap
());
Verifier
.
create
(
output
)
Step
Verifier
.
create
(
output
)
.
expectNext
(
ByteBuffer
.
wrap
(
"foo"
.
getBytes
()),
ByteBuffer
.
wrap
(
"bar"
.
getBytes
()))
.
expectComplete
()
.
verify
();
...
...
spring-core/src/test/java/org/springframework/core/codec/ByteBufferEncoderTests.java
浏览文件 @
8705df50
...
...
@@ -24,7 +24,7 @@ import org.junit.Before;
import
org.junit.Test
;
import
org.reactivestreams.Publisher
;
import
reactor.core.publisher.Flux
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.core.ResolvableType
;
import
org.springframework.core.io.buffer.AbstractDataBufferAllocatingTestCase
;
...
...
@@ -67,7 +67,7 @@ public class ByteBufferEncoderTests extends AbstractDataBufferAllocatingTestCase
Flux
<
DataBuffer
>
output
=
this
.
encoder
.
encode
(
source
,
this
.
bufferFactory
,
ResolvableType
.
forClassWithGenerics
(
Publisher
.
class
,
ByteBuffer
.
class
),
null
,
Collections
.
emptyMap
());
Verifier
.
create
(
output
)
Step
Verifier
.
create
(
output
)
.
consumeNextWith
(
b
->
{
byte
[]
buf
=
new
byte
[
3
];
b
.
read
(
buf
);
...
...
spring-core/src/test/java/org/springframework/core/codec/CharSequenceEncoderTests.java
浏览文件 @
8705df50
...
...
@@ -23,7 +23,7 @@ import org.junit.Test;
import
org.junit.runner.RunWith
;
import
org.junit.runners.Parameterized
;
import
reactor.core.publisher.Flux
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.core.ResolvableType
;
import
org.springframework.core.io.buffer.AbstractDataBufferAllocatingTestCase
;
...
...
@@ -65,7 +65,7 @@ public class CharSequenceEncoderTests extends AbstractDataBufferAllocatingTestCa
Flux
<
String
>
stringFlux
=
Flux
.
just
(
"foo"
);
Flux
<
DataBuffer
>
output
=
Flux
.
from
(
this
.
encoder
.
encode
(
stringFlux
,
this
.
bufferFactory
,
null
,
null
,
Collections
.
emptyMap
()));
Verifier
.
create
(
output
)
Step
Verifier
.
create
(
output
)
.
consumeNextWith
(
stringConsumer
(
"foo"
))
.
expectComplete
()
.
verify
();
...
...
@@ -76,7 +76,7 @@ public class CharSequenceEncoderTests extends AbstractDataBufferAllocatingTestCa
Flux
<
StringBuilder
>
stringBuilderFlux
=
Flux
.
just
(
new
StringBuilder
(
"foo"
));
Flux
<
DataBuffer
>
output
=
Flux
.
from
(
this
.
encoder
.
encode
(
stringBuilderFlux
,
this
.
bufferFactory
,
null
,
null
,
Collections
.
emptyMap
()));
Verifier
.
create
(
output
)
Step
Verifier
.
create
(
output
)
.
consumeNextWith
(
stringConsumer
(
"foo"
))
.
expectComplete
()
.
verify
();
...
...
spring-core/src/test/java/org/springframework/core/codec/ResourceDecoderTests.java
浏览文件 @
8705df50
...
...
@@ -21,7 +21,7 @@ import java.util.Collections;
import
org.junit.Test
;
import
reactor.core.publisher.Flux
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.core.ResolvableType
;
import
org.springframework.core.io.ByteArrayResource
;
...
...
@@ -64,7 +64,7 @@ public class ResourceDecoderTests extends AbstractDataBufferAllocatingTestCase {
Flux
<
Resource
>
result
=
this
.
decoder
.
decode
(
source
,
ResolvableType
.
forClass
(
Resource
.
class
),
null
,
Collections
.
emptyMap
());
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
consumeNextWith
(
resource
->
{
try
{
byte
[]
bytes
=
StreamUtils
.
copyToByteArray
(
resource
.
getInputStream
());
...
...
spring-core/src/test/java/org/springframework/core/codec/ResourceEncoderTests.java
浏览文件 @
8705df50
...
...
@@ -22,7 +22,7 @@ import java.util.Collections;
import
org.junit.Test
;
import
reactor.core.publisher.Flux
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.core.ResolvableType
;
import
org.springframework.core.io.ByteArrayResource
;
...
...
@@ -64,7 +64,7 @@ public class ResourceEncoderTests extends AbstractDataBufferAllocatingTestCase {
ResolvableType
.
forClass
(
Resource
.
class
),
null
,
Collections
.
emptyMap
());
Verifier
.
create
(
output
)
Step
Verifier
.
create
(
output
)
.
consumeNextWith
(
stringConsumer
(
s
))
.
expectComplete
()
.
verify
();
...
...
spring-core/src/test/java/org/springframework/core/codec/ResourceRegionEncoderTests.java
浏览文件 @
8705df50
...
...
@@ -23,7 +23,7 @@ import org.junit.Before;
import
org.junit.Test
;
import
reactor.core.publisher.Flux
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.core.ResolvableType
;
import
org.springframework.core.io.ByteArrayResource
;
...
...
@@ -81,7 +81,7 @@ public class ResourceRegionEncoderTests extends AbstractDataBufferAllocatingTest
ResolvableType
.
forClass
(
ResourceRegion
.
class
),
MimeTypeUtils
.
APPLICATION_OCTET_STREAM
,
Collections
.
emptyMap
());
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
consumeNextWith
(
stringConsumer
(
"Spring"
))
.
expectComplete
()
.
verify
();
...
...
@@ -111,7 +111,7 @@ public class ResourceRegionEncoderTests extends AbstractDataBufferAllocatingTest
return
previous
;
});
Verifier
.
create
(
reduced
)
Step
Verifier
.
create
(
reduced
)
.
consumeNextWith
(
buf
->
{
String
content
=
DataBufferTestUtils
.
dumpString
(
buf
,
StandardCharsets
.
UTF_8
);
String
[]
ranges
=
StringUtils
.
tokenizeToStringArray
(
content
,
"\r\n"
,
...
...
spring-core/src/test/java/org/springframework/core/codec/StringDecoderTests.java
浏览文件 @
8705df50
...
...
@@ -21,7 +21,7 @@ import java.util.Collections;
import
org.junit.Test
;
import
reactor.core.publisher.Flux
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.core.ResolvableType
;
import
org.springframework.core.io.buffer.AbstractDataBufferAllocatingTestCase
;
...
...
@@ -62,7 +62,7 @@ public class StringDecoderTests extends AbstractDataBufferAllocatingTestCase {
Flux
<
String
>
output
=
this
.
decoder
.
decode
(
source
,
ResolvableType
.
forClass
(
String
.
class
),
null
,
Collections
.
emptyMap
());
Verifier
.
create
(
output
)
Step
Verifier
.
create
(
output
)
.
expectNext
(
"foo"
,
"bar"
,
"baz"
)
.
expectComplete
()
.
verify
();
...
...
@@ -77,7 +77,7 @@ public class StringDecoderTests extends AbstractDataBufferAllocatingTestCase {
Flux
<
String
>
output
=
decoder
.
decode
(
source
,
ResolvableType
.
forClass
(
String
.
class
),
null
,
Collections
.
emptyMap
());
Verifier
.
create
(
output
)
Step
Verifier
.
create
(
output
)
.
expectNext
(
"\n"
,
"foo\r"
,
"\n"
,
"bar\r"
,
"\n"
,
"baz"
)
.
expectComplete
()
.
verify
();
...
...
@@ -90,7 +90,7 @@ public class StringDecoderTests extends AbstractDataBufferAllocatingTestCase {
Flux
<
String
>
output
=
this
.
decoder
.
decode
(
source
,
ResolvableType
.
forClass
(
String
.
class
),
null
,
Collections
.
emptyMap
());
Verifier
.
create
(
output
)
Step
Verifier
.
create
(
output
)
.
expectNextCount
(
0
)
.
expectComplete
()
.
verify
();
...
...
@@ -103,7 +103,7 @@ public class StringDecoderTests extends AbstractDataBufferAllocatingTestCase {
Flux
<
String
>
output
=
this
.
decoder
.
decode
(
source
,
ResolvableType
.
forClass
(
String
.
class
),
null
,
Collections
.
emptyMap
());
Verifier
.
create
(
output
)
Step
Verifier
.
create
(
output
)
.
expectNext
(
""
)
.
expectComplete
().
verify
();
...
...
@@ -116,7 +116,7 @@ public class StringDecoderTests extends AbstractDataBufferAllocatingTestCase {
Mono
<
String
>
output
=
this
.
decoder
.
decodeToMono
(
source
,
ResolvableType
.
forClass
(
String
.
class
),
null
,
Collections
.
emptyMap
());
Verifier
.
create
(
output
)
Step
Verifier
.
create
(
output
)
.
expectNext
(
"foobarbaz"
)
.
expectComplete
()
.
verify
();
...
...
@@ -128,7 +128,7 @@ public class StringDecoderTests extends AbstractDataBufferAllocatingTestCase {
Mono
<
String
>
output
=
this
.
decoder
.
decodeToMono
(
source
,
ResolvableType
.
forClass
(
String
.
class
),
null
,
Collections
.
emptyMap
());
Verifier
.
create
(
output
)
Step
Verifier
.
create
(
output
)
.
expectNextCount
(
0
)
.
expectComplete
()
.
verify
();
...
...
spring-core/src/test/java/org/springframework/core/io/buffer/DataBufferUtilsTests.java
浏览文件 @
8705df50
...
...
@@ -24,7 +24,7 @@ import java.nio.file.StandardOpenOption;
import
org.junit.Test
;
import
reactor.core.publisher.Flux
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
...
...
@@ -39,7 +39,7 @@ public class DataBufferUtilsTests extends AbstractDataBufferAllocatingTestCase {
FileChannel
channel
=
FileChannel
.
open
(
Paths
.
get
(
uri
),
StandardOpenOption
.
READ
);
Flux
<
DataBuffer
>
flux
=
DataBufferUtils
.
read
(
channel
,
this
.
bufferFactory
,
3
);
Verifier
.
create
(
flux
)
Step
Verifier
.
create
(
flux
)
.
consumeNextWith
(
stringConsumer
(
"foo"
))
.
consumeNextWith
(
stringConsumer
(
"bar"
))
.
consumeNextWith
(
stringConsumer
(
"baz"
))
...
...
@@ -56,7 +56,7 @@ public class DataBufferUtilsTests extends AbstractDataBufferAllocatingTestCase {
FileChannel
channel
=
FileChannel
.
open
(
Paths
.
get
(
uri
),
StandardOpenOption
.
READ
);
Flux
<
DataBuffer
>
flux
=
DataBufferUtils
.
read
(
channel
,
this
.
bufferFactory
,
5
);
Verifier
.
create
(
flux
)
Step
Verifier
.
create
(
flux
)
.
consumeNextWith
(
stringConsumer
(
"fooba"
))
.
consumeNextWith
(
stringConsumer
(
"rbazq"
))
.
consumeNextWith
(
stringConsumer
(
"ux"
))
...
...
@@ -71,7 +71,7 @@ public class DataBufferUtilsTests extends AbstractDataBufferAllocatingTestCase {
InputStream
is
=
DataBufferUtilsTests
.
class
.
getResourceAsStream
(
"DataBufferUtilsTests.txt"
);
Flux
<
DataBuffer
>
flux
=
DataBufferUtils
.
read
(
is
,
this
.
bufferFactory
,
3
);
Verifier
.
create
(
flux
)
Step
Verifier
.
create
(
flux
)
.
consumeNextWith
(
stringConsumer
(
"foo"
))
.
consumeNextWith
(
stringConsumer
(
"bar"
))
.
consumeNextWith
(
stringConsumer
(
"baz"
))
...
...
@@ -88,7 +88,7 @@ public class DataBufferUtilsTests extends AbstractDataBufferAllocatingTestCase {
Flux
<
DataBuffer
>
flux
=
Flux
.
just
(
foo
,
bar
,
baz
);
Flux
<
DataBuffer
>
result
=
DataBufferUtils
.
takeUntilByteCount
(
flux
,
5L
);
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
consumeNextWith
(
stringConsumer
(
"foo"
))
.
consumeNextWith
(
stringConsumer
(
"ba"
))
.
expectComplete
().
verify
();
...
...
@@ -104,7 +104,7 @@ public class DataBufferUtilsTests extends AbstractDataBufferAllocatingTestCase {
Flux
<
DataBuffer
>
flux
=
Flux
.
just
(
foo
,
bar
,
baz
);
Flux
<
DataBuffer
>
result
=
DataBufferUtils
.
skipUntilByteCount
(
flux
,
5L
);
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
consumeNextWith
(
stringConsumer
(
"r"
))
.
consumeNextWith
(
stringConsumer
(
"baz"
))
.
expectComplete
()
...
...
@@ -119,7 +119,7 @@ public class DataBufferUtilsTests extends AbstractDataBufferAllocatingTestCase {
Flux
<
DataBuffer
>
flux
=
Flux
.
just
(
foo
,
bar
,
baz
);
Flux
<
DataBuffer
>
result
=
DataBufferUtils
.
skipUntilByteCount
(
flux
,
9L
);
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
expectNextCount
(
0
)
.
expectComplete
()
.
verify
();
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/DispatcherHandlerErrorTests.java
浏览文件 @
8705df50
...
...
@@ -23,7 +23,7 @@ import org.junit.Before;
import
org.junit.Test
;
import
org.reactivestreams.Publisher
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
org.springframework.context.annotation.Bean
;
...
...
@@ -99,7 +99,7 @@ public class DispatcherHandlerErrorTests {
this
.
request
.
setUri
(
"/does-not-exist"
);
Mono
<
Void
>
publisher
=
this
.
dispatcherHandler
.
handle
(
this
.
exchange
);
Verifier
.
create
(
publisher
)
Step
Verifier
.
create
(
publisher
)
.
consumeErrorWith
(
error
->
{
assertThat
(
error
,
instanceOf
(
ResponseStatusException
.
class
));
assertThat
(
error
.
getMessage
(),
...
...
@@ -113,7 +113,7 @@ public class DispatcherHandlerErrorTests {
this
.
request
.
setUri
(
"/unknown-argument-type"
);
Mono
<
Void
>
publisher
=
this
.
dispatcherHandler
.
handle
(
this
.
exchange
);
Verifier
.
create
(
publisher
)
Step
Verifier
.
create
(
publisher
)
.
consumeErrorWith
(
error
->
{
assertThat
(
error
,
instanceOf
(
IllegalStateException
.
class
));
assertThat
(
error
.
getMessage
(),
startsWith
(
"No resolver for argument [0]"
));
...
...
@@ -126,7 +126,7 @@ public class DispatcherHandlerErrorTests {
this
.
request
.
setUri
(
"/error-signal"
);
Mono
<
Void
>
publisher
=
this
.
dispatcherHandler
.
handle
(
this
.
exchange
);
Verifier
.
create
(
publisher
)
Step
Verifier
.
create
(
publisher
)
.
consumeErrorWith
(
error
->
{
assertSame
(
EXCEPTION
,
error
);
})
...
...
@@ -138,7 +138,7 @@ public class DispatcherHandlerErrorTests {
this
.
request
.
setUri
(
"/raise-exception"
);
Mono
<
Void
>
publisher
=
this
.
dispatcherHandler
.
handle
(
this
.
exchange
);
Verifier
.<
Void
>
create
(
publisher
)
Step
Verifier
.<
Void
>
create
(
publisher
)
.
consumeErrorWith
(
error
->
{
assertSame
(
EXCEPTION
,
error
);
})
...
...
@@ -150,7 +150,7 @@ public class DispatcherHandlerErrorTests {
this
.
request
.
setUri
(
"/unknown-return-type"
);
Mono
<
Void
>
publisher
=
this
.
dispatcherHandler
.
handle
(
this
.
exchange
);
Verifier
.
create
(
publisher
)
Step
Verifier
.
create
(
publisher
)
.
consumeErrorWith
(
error
->
{
assertThat
(
error
,
instanceOf
(
IllegalStateException
.
class
));
assertThat
(
error
.
getMessage
(),
startsWith
(
"No HandlerResultHandler"
));
...
...
@@ -163,7 +163,7 @@ public class DispatcherHandlerErrorTests {
this
.
request
.
setUri
(
"/request-body"
).
setHeader
(
"Accept"
,
"application/json"
).
setBody
(
"body"
);
Mono
<
Void
>
publisher
=
this
.
dispatcherHandler
.
handle
(
this
.
exchange
);
Verifier
.
create
(
publisher
)
Step
Verifier
.
create
(
publisher
)
.
consumeErrorWith
(
error
->
{
assertThat
(
error
,
instanceOf
(
NotAcceptableStatusException
.
class
));
})
...
...
@@ -175,7 +175,7 @@ public class DispatcherHandlerErrorTests {
this
.
request
.
setUri
(
"/request-body"
).
setBody
(
Mono
.
error
(
EXCEPTION
));
Mono
<
Void
>
publisher
=
this
.
dispatcherHandler
.
handle
(
this
.
exchange
);
Verifier
.
create
(
publisher
)
Step
Verifier
.
create
(
publisher
)
.
consumeErrorWith
(
error
->
{
assertThat
(
error
,
instanceOf
(
ServerWebInputException
.
class
));
assertSame
(
EXCEPTION
,
error
.
getCause
());
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/config/ResourceHandlerRegistryTests.java
浏览文件 @
8705df50
...
...
@@ -24,7 +24,7 @@ import org.hamcrest.Matchers;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.mockito.Mockito
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.cache.concurrent.ConcurrentMapCache
;
import
org.springframework.context.support.GenericApplicationContext
;
...
...
@@ -100,7 +100,7 @@ public class ResourceHandlerRegistryTests {
ResourceWebHandler
handler
=
getHandler
(
"/resources/**"
);
handler
.
handle
(
this
.
exchange
).
blockMillis
(
5000
);
Verifier
.
create
(
this
.
response
.
getBody
())
Step
Verifier
.
create
(
this
.
response
.
getBody
())
.
consumeNextWith
(
buf
->
assertEquals
(
"test stylesheet content"
,
DataBufferTestUtils
.
dumpString
(
buf
,
StandardCharsets
.
UTF_8
)))
.
expectComplete
()
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/function/SseHandlerFunctionIntegrationTests.java
浏览文件 @
8705df50
...
...
@@ -23,7 +23,7 @@ import org.junit.Test;
import
org.reactivestreams.Publisher
;
import
reactor.core.publisher.Flux
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.client.reactive.ReactorClientHttpConnector
;
...
...
@@ -74,7 +74,7 @@ public class SseHandlerFunctionIntegrationTests
.
map
(
s
->
(
s
.
replace
(
"\n"
,
""
)))
.
take
(
2
);
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
expectNext
(
"data:foo 0"
)
.
expectNext
(
"data:foo 1"
)
.
expectComplete
()
...
...
@@ -97,7 +97,7 @@ public class SseHandlerFunctionIntegrationTests
.
takeUntil
(
s
->
s
.
endsWith
(
"foo 1\"}"
))
.
reduce
((
s1
,
s2
)
->
s1
+
s2
);
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
expectNext
(
"data:{\"name\":\"foo 0\"}data:{\"name\":\"foo 1\"}"
)
.
expectComplete
()
.
verify
(
Duration
.
ofSeconds
(
5
));
...
...
@@ -118,7 +118,7 @@ public class SseHandlerFunctionIntegrationTests
.
map
(
s
->
s
.
replace
(
"\n"
,
""
))
.
take
(
2
);
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
expectNext
(
"id:0:bardata:foo"
)
.
expectNext
(
"id:1:bardata:foo"
)
.
expectComplete
()
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/resource/ResourceWebHandlerTests.java
浏览文件 @
8705df50
...
...
@@ -28,7 +28,7 @@ import org.junit.Before;
import
org.junit.Test
;
import
reactor.core.publisher.Flux
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.core.io.ClassPathResource
;
import
org.springframework.core.io.Resource
;
...
...
@@ -527,7 +527,7 @@ public class ResourceWebHandlerTests {
this
.
request
.
addHeader
(
"Range"
,
"bytes= foo bar"
);
this
.
exchange
.
getAttributes
().
put
(
PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE
,
"foo.txt"
);
Verifier
.
create
(
this
.
handler
.
handle
(
this
.
exchange
))
Step
Verifier
.
create
(
this
.
handler
.
handle
(
this
.
exchange
))
.
expectNextCount
(
0
)
.
expectComplete
()
.
verify
();
...
...
@@ -555,7 +555,7 @@ public class ResourceWebHandlerTests {
return
previous
;
});
Verifier
.
create
(
reduced
)
Step
Verifier
.
create
(
reduced
)
.
consumeNextWith
(
buf
->
{
String
content
=
DataBufferTestUtils
.
dumpString
(
buf
,
StandardCharsets
.
UTF_8
);
String
[]
ranges
=
StringUtils
.
tokenizeToStringArray
(
content
,
"\r\n"
,
false
,
true
);
...
...
@@ -598,7 +598,7 @@ public class ResourceWebHandlerTests {
}
private
void
assertResponseBody
(
String
responseBody
)
{
Verifier
.
create
(
this
.
response
.
getBody
())
Step
Verifier
.
create
(
this
.
response
.
getBody
())
.
consumeNextWith
(
buf
->
assertEquals
(
responseBody
,
DataBufferTestUtils
.
dumpString
(
buf
,
StandardCharsets
.
UTF_8
)))
.
expectComplete
()
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/HandlerMethodMappingTests.java
浏览文件 @
8705df50
...
...
@@ -26,7 +26,7 @@ import java.util.Set;
import
org.junit.Before
;
import
org.junit.Test
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.http.server.reactive.ServerHttpRequest
;
...
...
@@ -100,7 +100,7 @@ public class HandlerMethodMappingTests {
this
.
mapping
.
registerMapping
(
"/fo?"
,
this
.
handler
,
this
.
method2
);
Mono
<
Object
>
result
=
this
.
mapping
.
getHandler
(
createExchange
(
HttpMethod
.
GET
,
"/foo"
));
Verifier
.
create
(
result
).
expectError
(
IllegalStateException
.
class
).
verify
();
Step
Verifier
.
create
(
result
).
expectError
(
IllegalStateException
.
class
).
verify
();
}
@Test
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/InvocableHandlerMethodTests.java
浏览文件 @
8705df50
...
...
@@ -21,7 +21,7 @@ import java.util.Optional;
import
org.junit.Before
;
import
org.junit.Test
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.mock.http.server.reactive.test.MockServerHttpRequest
;
...
...
@@ -92,7 +92,7 @@ public class InvocableHandlerMethodTests {
InvocableHandlerMethod
hm
=
handlerMethod
(
"singleArg"
);
Mono
<
HandlerResult
>
mono
=
hm
.
invoke
(
this
.
exchange
,
new
BindingContext
());
Verifier
.
create
(
mono
)
Step
Verifier
.
create
(
mono
)
.
expectNextCount
(
0
)
.
consumeErrorWith
(
error
->
{
assertThat
(
error
,
instanceOf
(
IllegalStateException
.
class
));
...
...
@@ -108,7 +108,7 @@ public class InvocableHandlerMethodTests {
addResolver
(
hm
,
Mono
.
error
(
new
UnsupportedMediaTypeStatusException
(
"boo"
)));
Mono
<
HandlerResult
>
mono
=
hm
.
invoke
(
this
.
exchange
,
new
BindingContext
());
Verifier
.
create
(
mono
)
Step
Verifier
.
create
(
mono
)
.
expectNextCount
(
0
)
.
consumeErrorWith
(
error
->
{
assertThat
(
error
,
instanceOf
(
UnsupportedMediaTypeStatusException
.
class
));
...
...
@@ -123,7 +123,7 @@ public class InvocableHandlerMethodTests {
addResolver
(
hm
,
Mono
.
just
(
1
));
Mono
<
HandlerResult
>
mono
=
hm
.
invoke
(
this
.
exchange
,
new
BindingContext
());
Verifier
.
create
(
mono
)
Step
Verifier
.
create
(
mono
)
.
expectNextCount
(
0
)
.
consumeErrorWith
(
error
->
{
assertThat
(
error
,
instanceOf
(
IllegalStateException
.
class
));
...
...
@@ -139,7 +139,7 @@ public class InvocableHandlerMethodTests {
InvocableHandlerMethod
hm
=
handlerMethod
(
"exceptionMethod"
);
Mono
<
HandlerResult
>
mono
=
hm
.
invoke
(
this
.
exchange
,
new
BindingContext
());
Verifier
.
create
(
mono
)
Step
Verifier
.
create
(
mono
)
.
expectNextCount
(
0
)
.
consumeErrorWith
(
error
->
{
assertThat
(
error
,
instanceOf
(
IllegalStateException
.
class
));
...
...
@@ -162,7 +162,7 @@ public class InvocableHandlerMethodTests {
}
private
void
assertHandlerResultValue
(
Mono
<
HandlerResult
>
mono
,
String
expected
)
{
Verifier
.
create
(
mono
)
Step
Verifier
.
create
(
mono
)
.
consumeNextWith
(
result
->
{
Optional
<?>
optional
=
result
.
getReturnValue
();
assertTrue
(
optional
.
isPresent
());
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/RequestMappingInfoHandlerMappingTests.java
浏览文件 @
8705df50
...
...
@@ -29,7 +29,7 @@ import java.util.function.Consumer;
import
org.junit.Before
;
import
org.junit.Test
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.core.annotation.AnnotatedElementUtils
;
import
org.springframework.core.annotation.AnnotationUtils
;
...
...
@@ -164,7 +164,7 @@ public class RequestMappingInfoHandlerMappingTests {
this
.
handlerMapping
.
registerHandler
(
new
UserController
());
Mono
<
Object
>
mono
=
this
.
handlerMapping
.
getHandler
(
exchange
);
Verifier
.
create
(
mono
)
Step
Verifier
.
create
(
mono
)
.
expectError
(
NotAcceptableStatusException
.
class
)
.
verify
();
}
...
...
@@ -353,7 +353,7 @@ public class RequestMappingInfoHandlerMappingTests {
@SuppressWarnings
(
"unchecked"
)
private
<
T
>
void
assertError
(
Mono
<
Object
>
mono
,
final
Class
<
T
>
exceptionClass
,
final
Consumer
<
T
>
consumer
)
{
Verifier
.
create
(
mono
)
Step
Verifier
.
create
(
mono
)
.
consumeErrorWith
(
error
->
{
assertEquals
(
exceptionClass
,
error
.
getClass
());
consumer
.
accept
((
T
)
error
);
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/CookieValueMethodArgumentResolverTests.java
浏览文件 @
8705df50
...
...
@@ -21,7 +21,7 @@ import java.lang.reflect.Method;
import
org.junit.Before
;
import
org.junit.Test
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
org.springframework.core.MethodParameter
;
...
...
@@ -119,7 +119,7 @@ public class CookieValueMethodArgumentResolverTests {
@Test
public
void
notFound
()
{
Mono
<
Object
>
mono
=
resolver
.
resolveArgument
(
this
.
cookieParameter
,
this
.
bindingContext
,
this
.
exchange
);
Verifier
.
create
(
mono
)
Step
Verifier
.
create
(
mono
)
.
expectNextCount
(
0
)
.
expectError
(
ServerWebInputException
.
class
)
.
verify
();
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/HttpEntityArgumentResolverTests.java
浏览文件 @
8705df50
...
...
@@ -29,7 +29,7 @@ import org.junit.Before;
import
org.junit.Test
;
import
reactor.core.publisher.Flux
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
rx.Observable
;
import
rx.RxReactiveStreams
;
import
rx.Single
;
...
...
@@ -130,7 +130,7 @@ public class HttpEntityArgumentResolverTests {
ResolvableType
type
=
httpEntityType
(
forClassWithGenerics
(
Mono
.
class
,
String
.
class
));
HttpEntity
<
Mono
<
String
>>
entity
=
resolveValueWithEmptyBody
(
type
);
Verifier
.
create
(
entity
.
getBody
()).
expectNextCount
(
0
).
expectComplete
().
verify
();
Step
Verifier
.
create
(
entity
.
getBody
()).
expectNextCount
(
0
).
expectComplete
().
verify
();
}
@Test
...
...
@@ -138,7 +138,7 @@ public class HttpEntityArgumentResolverTests {
ResolvableType
type
=
httpEntityType
(
forClassWithGenerics
(
Flux
.
class
,
String
.
class
));
HttpEntity
<
Flux
<
String
>>
entity
=
resolveValueWithEmptyBody
(
type
);
Verifier
.
create
(
entity
.
getBody
()).
expectNextCount
(
0
).
expectComplete
().
verify
();
Step
Verifier
.
create
(
entity
.
getBody
()).
expectNextCount
(
0
).
expectComplete
().
verify
();
}
@Test
...
...
@@ -146,7 +146,7 @@ public class HttpEntityArgumentResolverTests {
ResolvableType
type
=
httpEntityType
(
forClassWithGenerics
(
Single
.
class
,
String
.
class
));
HttpEntity
<
Single
<
String
>>
entity
=
resolveValueWithEmptyBody
(
type
);
Verifier
.
create
(
RxReactiveStreams
.
toPublisher
(
entity
.
getBody
()))
Step
Verifier
.
create
(
RxReactiveStreams
.
toPublisher
(
entity
.
getBody
()))
.
expectNextCount
(
0
)
.
expectError
(
ServerWebInputException
.
class
)
.
verify
();
...
...
@@ -157,7 +157,7 @@ public class HttpEntityArgumentResolverTests {
ResolvableType
type
=
httpEntityType
(
forClassWithGenerics
(
io
.
reactivex
.
Single
.
class
,
String
.
class
));
HttpEntity
<
io
.
reactivex
.
Single
<
String
>>
entity
=
resolveValueWithEmptyBody
(
type
);
Verifier
.
create
(
entity
.
getBody
().
toFlowable
())
Step
Verifier
.
create
(
entity
.
getBody
().
toFlowable
())
.
expectNextCount
(
0
)
.
expectError
(
ServerWebInputException
.
class
)
.
verify
();
...
...
@@ -168,7 +168,7 @@ public class HttpEntityArgumentResolverTests {
ResolvableType
type
=
httpEntityType
(
forClassWithGenerics
(
Maybe
.
class
,
String
.
class
));
HttpEntity
<
Maybe
<
String
>>
entity
=
resolveValueWithEmptyBody
(
type
);
Verifier
.
create
(
entity
.
getBody
().
toFlowable
())
Step
Verifier
.
create
(
entity
.
getBody
().
toFlowable
())
.
expectNextCount
(
0
)
.
expectComplete
()
.
verify
();
...
...
@@ -179,7 +179,7 @@ public class HttpEntityArgumentResolverTests {
ResolvableType
type
=
httpEntityType
(
forClassWithGenerics
(
Observable
.
class
,
String
.
class
));
HttpEntity
<
Observable
<
String
>>
entity
=
resolveValueWithEmptyBody
(
type
);
Verifier
.
create
(
RxReactiveStreams
.
toPublisher
(
entity
.
getBody
()))
Step
Verifier
.
create
(
RxReactiveStreams
.
toPublisher
(
entity
.
getBody
()))
.
expectNextCount
(
0
)
.
expectComplete
()
.
verify
();
...
...
@@ -190,7 +190,7 @@ public class HttpEntityArgumentResolverTests {
ResolvableType
type
=
httpEntityType
(
forClassWithGenerics
(
io
.
reactivex
.
Observable
.
class
,
String
.
class
));
HttpEntity
<
io
.
reactivex
.
Observable
<
String
>>
entity
=
resolveValueWithEmptyBody
(
type
);
Verifier
.
create
(
entity
.
getBody
().
toFlowable
(
BackpressureStrategy
.
BUFFER
))
Step
Verifier
.
create
(
entity
.
getBody
().
toFlowable
(
BackpressureStrategy
.
BUFFER
))
.
expectNextCount
(
0
)
.
expectComplete
()
.
verify
();
...
...
@@ -201,7 +201,7 @@ public class HttpEntityArgumentResolverTests {
ResolvableType
type
=
httpEntityType
(
forClassWithGenerics
(
Flowable
.
class
,
String
.
class
));
HttpEntity
<
Flowable
<
String
>>
entity
=
resolveValueWithEmptyBody
(
type
);
Verifier
.
create
(
entity
.
getBody
())
Step
Verifier
.
create
(
entity
.
getBody
())
.
expectNextCount
(
0
)
.
expectComplete
()
.
verify
();
...
...
@@ -285,7 +285,7 @@ public class HttpEntityArgumentResolverTests {
HttpEntity
<
Flux
<
String
>>
httpEntity
=
resolveValue
(
type
,
body
);
assertEquals
(
this
.
request
.
getHeaders
(),
httpEntity
.
getHeaders
());
Verifier
.
create
(
httpEntity
.
getBody
())
Step
Verifier
.
create
(
httpEntity
.
getBody
())
.
expectNext
(
"line1\n"
)
.
expectNext
(
"line2\n"
)
.
expectNext
(
"line3\n"
)
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/MessageReaderArgumentResolverTests.java
浏览文件 @
8705df50
...
...
@@ -34,7 +34,7 @@ import org.junit.Before;
import
org.junit.Test
;
import
reactor.core.publisher.Flux
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
rx.Observable
;
import
rx.Single
;
...
...
@@ -103,7 +103,7 @@ public class MessageReaderArgumentResolverTests {
MethodParameter
param
=
this
.
testMethod
.
resolveParam
(
type
);
Mono
<
Object
>
result
=
this
.
resolver
.
readBody
(
param
,
true
,
this
.
bindingContext
,
this
.
exchange
);
Verifier
.
create
(
result
).
expectError
(
UnsupportedMediaTypeStatusException
.
class
).
verify
();
Step
Verifier
.
create
(
result
).
expectError
(
UnsupportedMediaTypeStatusException
.
class
).
verify
();
}
// More extensive "empty body" tests in RequestBody- and HttpEntityArgumentResolverTests
...
...
@@ -116,7 +116,7 @@ public class MessageReaderArgumentResolverTests {
Mono
<
TestBean
>
result
=
(
Mono
<
TestBean
>)
this
.
resolver
.
readBody
(
param
,
true
,
this
.
bindingContext
,
this
.
exchange
).
block
();
Verifier
.
create
(
result
).
expectError
(
ServerWebInputException
.
class
).
verify
();
Step
Verifier
.
create
(
result
).
expectError
(
ServerWebInputException
.
class
).
verify
();
}
@Test
...
...
@@ -273,7 +273,7 @@ public class MessageReaderArgumentResolverTests {
MethodParameter
param
=
this
.
testMethod
.
resolveParam
(
type
);
Mono
<
TestBean
>
mono
=
resolveValue
(
param
,
body
);
Verifier
.
create
(
mono
).
expectNextCount
(
0
).
expectError
(
ServerWebInputException
.
class
).
verify
();
Step
Verifier
.
create
(
mono
).
expectNextCount
(
0
).
expectError
(
ServerWebInputException
.
class
).
verify
();
}
@Test
@SuppressWarnings
(
"unchecked"
)
...
...
@@ -283,7 +283,7 @@ public class MessageReaderArgumentResolverTests {
MethodParameter
param
=
this
.
testMethod
.
resolveParam
(
type
);
Flux
<
TestBean
>
flux
=
resolveValue
(
param
,
body
);
Verifier
.
create
(
flux
)
Step
Verifier
.
create
(
flux
)
.
expectNext
(
new
TestBean
(
"f1"
,
"b1"
))
.
expectError
(
ServerWebInputException
.
class
)
.
verify
();
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/MessageWriterResultHandlerTests.java
浏览文件 @
8705df50
...
...
@@ -33,7 +33,7 @@ import org.junit.Before;
import
org.junit.Test
;
import
reactor.core.publisher.Flux
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
rx.Completable
;
import
rx.Observable
;
...
...
@@ -137,7 +137,7 @@ public class MessageWriterResultHandlerTests {
HttpMessageWriter
<?>
writer
=
new
EncoderHttpMessageWriter
<>(
new
ByteBufferEncoder
());
Mono
<
Void
>
mono
=
createResultHandler
(
writer
).
writeBody
(
body
,
returnType
(
type
),
this
.
exchange
);
Verifier
.
create
(
mono
).
expectError
(
IllegalStateException
.
class
).
verify
();
Step
Verifier
.
create
(
mono
).
expectError
(
IllegalStateException
.
class
).
verify
();
}
@Test
// SPR-12811
...
...
@@ -194,7 +194,7 @@ public class MessageWriterResultHandlerTests {
}
private
void
assertResponseBody
(
String
responseBody
)
{
Verifier
.
create
(
this
.
response
.
getBody
())
Step
Verifier
.
create
(
this
.
response
.
getBody
())
.
consumeNextWith
(
buf
->
assertEquals
(
responseBody
,
DataBufferTestUtils
.
dumpString
(
buf
,
StandardCharsets
.
UTF_8
)))
.
expectComplete
()
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/PathVariableMethodArgumentResolverTests.java
浏览文件 @
8705df50
...
...
@@ -24,7 +24,7 @@ import java.util.Optional;
import
org.junit.Before
;
import
org.junit.Test
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.core.MethodParameter
;
import
org.springframework.core.annotation.SynthesizingMethodParameter
;
...
...
@@ -134,7 +134,7 @@ public class PathVariableMethodArgumentResolverTests {
public
void
handleMissingValue
()
throws
Exception
{
BindingContext
bindingContext
=
new
BindingContext
();
Mono
<
Object
>
mono
=
this
.
resolver
.
resolveArgument
(
this
.
paramNamedString
,
bindingContext
,
this
.
exchange
);
Verifier
.
create
(
mono
)
Step
Verifier
.
create
(
mono
)
.
expectNextCount
(
0
)
.
expectError
(
ServerErrorException
.
class
)
.
verify
();
...
...
@@ -144,8 +144,7 @@ public class PathVariableMethodArgumentResolverTests {
public
void
nullIfNotRequired
()
throws
Exception
{
BindingContext
bindingContext
=
new
BindingContext
();
Mono
<
Object
>
mono
=
this
.
resolver
.
resolveArgument
(
this
.
paramNotRequired
,
bindingContext
,
this
.
exchange
);
Verifier
.
create
(
mono
)
StepVerifier
.
create
(
mono
)
.
expectNextCount
(
0
)
.
expectComplete
()
.
verify
();
...
...
@@ -156,7 +155,7 @@ public class PathVariableMethodArgumentResolverTests {
BindingContext
bindingContext
=
new
BindingContext
();
Mono
<
Object
>
mono
=
this
.
resolver
.
resolveArgument
(
this
.
paramOptional
,
bindingContext
,
this
.
exchange
);
Verifier
.
create
(
mono
)
Step
Verifier
.
create
(
mono
)
.
consumeNextWith
(
value
->
{
assertTrue
(
value
instanceof
Optional
);
assertFalse
(((
Optional
)
value
).
isPresent
());
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestAttributeMethodArgumentResolverTests.java
浏览文件 @
8705df50
...
...
@@ -21,7 +21,7 @@ import java.util.Optional;
import
org.junit.Before
;
import
org.junit.Test
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
org.springframework.core.DefaultParameterNameDiscoverer
;
...
...
@@ -89,7 +89,7 @@ public class RequestAttributeMethodArgumentResolverTests {
public
void
resolve
()
throws
Exception
{
MethodParameter
param
=
initMethodParameter
(
0
);
Mono
<
Object
>
mono
=
this
.
resolver
.
resolveArgument
(
param
,
new
BindingContext
(),
this
.
exchange
);
Verifier
.
create
(
mono
)
Step
Verifier
.
create
(
mono
)
.
expectNextCount
(
0
)
.
expectError
(
ServerWebInputException
.
class
)
.
verify
();
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestBodyArgumentResolverTests.java
浏览文件 @
8705df50
...
...
@@ -27,7 +27,7 @@ import org.junit.Before;
import
org.junit.Test
;
import
reactor.core.publisher.Flux
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
rx.Observable
;
import
rx.RxReactiveStreams
;
import
rx.Single
;
...
...
@@ -126,12 +126,12 @@ public class RequestBodyArgumentResolverTests {
public
void
emptyBodyWithMono
()
throws
Exception
{
ResolvableType
type
=
forClassWithGenerics
(
Mono
.
class
,
String
.
class
);
Verifier
.
create
((
Mono
<
Void
>)
resolveValueWithEmptyBody
(
type
,
true
))
Step
Verifier
.
create
((
Mono
<
Void
>)
resolveValueWithEmptyBody
(
type
,
true
))
.
expectNextCount
(
0
)
.
expectError
(
ServerWebInputException
.
class
)
.
verify
();
Verifier
.
create
((
Mono
<
Void
>)
resolveValueWithEmptyBody
(
type
,
false
))
Step
Verifier
.
create
((
Mono
<
Void
>)
resolveValueWithEmptyBody
(
type
,
false
))
.
expectNextCount
(
0
)
.
expectComplete
()
.
verify
();
...
...
@@ -142,12 +142,12 @@ public class RequestBodyArgumentResolverTests {
public
void
emptyBodyWithFlux
()
throws
Exception
{
ResolvableType
type
=
forClassWithGenerics
(
Flux
.
class
,
String
.
class
);
Verifier
.
create
((
Flux
<
Void
>)
resolveValueWithEmptyBody
(
type
,
true
))
Step
Verifier
.
create
((
Flux
<
Void
>)
resolveValueWithEmptyBody
(
type
,
true
))
.
expectNextCount
(
0
)
.
expectError
(
ServerWebInputException
.
class
)
.
verify
();
Verifier
.
create
((
Flux
<
Void
>)
resolveValueWithEmptyBody
(
type
,
false
))
Step
Verifier
.
create
((
Flux
<
Void
>)
resolveValueWithEmptyBody
(
type
,
false
))
.
expectNextCount
(
0
)
.
expectComplete
()
.
verify
();
...
...
@@ -158,13 +158,13 @@ public class RequestBodyArgumentResolverTests {
ResolvableType
type
=
forClassWithGenerics
(
Single
.
class
,
String
.
class
);
Single
<
String
>
single
=
resolveValueWithEmptyBody
(
type
,
true
);
Verifier
.
create
(
RxReactiveStreams
.
toPublisher
(
single
))
Step
Verifier
.
create
(
RxReactiveStreams
.
toPublisher
(
single
))
.
expectNextCount
(
0
)
.
expectError
(
ServerWebInputException
.
class
)
.
verify
();
single
=
resolveValueWithEmptyBody
(
type
,
false
);
Verifier
.
create
(
RxReactiveStreams
.
toPublisher
(
single
))
Step
Verifier
.
create
(
RxReactiveStreams
.
toPublisher
(
single
))
.
expectNextCount
(
0
)
.
expectError
(
ServerWebInputException
.
class
)
.
verify
();
...
...
@@ -175,13 +175,13 @@ public class RequestBodyArgumentResolverTests {
ResolvableType
type
=
forClassWithGenerics
(
Maybe
.
class
,
String
.
class
);
Maybe
<
String
>
maybe
=
resolveValueWithEmptyBody
(
type
,
true
);
Verifier
.
create
(
maybe
.
toFlowable
())
Step
Verifier
.
create
(
maybe
.
toFlowable
())
.
expectNextCount
(
0
)
.
expectError
(
ServerWebInputException
.
class
)
.
verify
();
maybe
=
resolveValueWithEmptyBody
(
type
,
false
);
Verifier
.
create
(
maybe
.
toFlowable
())
Step
Verifier
.
create
(
maybe
.
toFlowable
())
.
expectNextCount
(
0
)
.
expectComplete
()
.
verify
();
...
...
@@ -192,13 +192,13 @@ public class RequestBodyArgumentResolverTests {
ResolvableType
type
=
forClassWithGenerics
(
Observable
.
class
,
String
.
class
);
Observable
<
String
>
observable
=
resolveValueWithEmptyBody
(
type
,
true
);
Verifier
.
create
(
RxReactiveStreams
.
toPublisher
(
observable
))
Step
Verifier
.
create
(
RxReactiveStreams
.
toPublisher
(
observable
))
.
expectNextCount
(
0
)
.
expectError
(
ServerWebInputException
.
class
)
.
verify
();
observable
=
resolveValueWithEmptyBody
(
type
,
false
);
Verifier
.
create
(
RxReactiveStreams
.
toPublisher
(
observable
))
Step
Verifier
.
create
(
RxReactiveStreams
.
toPublisher
(
observable
))
.
expectNextCount
(
0
)
.
expectComplete
()
.
verify
();
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestHeaderMethodArgumentResolverTests.java
浏览文件 @
8705df50
...
...
@@ -26,7 +26,7 @@ import java.util.Map;
import
org.junit.Before
;
import
org.junit.Test
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
org.springframework.core.MethodParameter
;
...
...
@@ -203,7 +203,7 @@ public class RequestHeaderMethodArgumentResolverTests {
Mono
<
Object
>
mono
=
resolver
.
resolveArgument
(
this
.
paramNamedValueStringArray
,
this
.
bindingContext
,
this
.
exchange
);
Verifier
.
create
(
mono
)
Step
Verifier
.
create
(
mono
)
.
expectNextCount
(
0
)
.
expectError
(
ServerWebInputException
.
class
)
.
verify
();
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestParamMethodArgumentResolverTests.java
浏览文件 @
8705df50
...
...
@@ -24,7 +24,7 @@ import java.util.Optional;
import
org.junit.Before
;
import
org.junit.Test
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.core.LocalVariableTableParameterNameDiscoverer
;
import
org.springframework.core.MethodParameter
;
...
...
@@ -159,7 +159,7 @@ public class RequestParamMethodArgumentResolverTests {
Mono
<
Object
>
mono
=
this
.
resolver
.
resolveArgument
(
this
.
paramNamedStringArray
,
this
.
bindingContext
,
this
.
exchange
);
Verifier
.
create
(
mono
)
Step
Verifier
.
create
(
mono
)
.
expectNextCount
(
0
)
.
expectError
(
ServerWebInputException
.
class
)
.
verify
();
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ResponseEntityResultHandlerTests.java
浏览文件 @
8705df50
...
...
@@ -29,7 +29,7 @@ import java.util.concurrent.CompletableFuture;
import
org.junit.Before
;
import
org.junit.Test
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
rx.Completable
;
import
rx.Single
;
...
...
@@ -291,7 +291,7 @@ public class ResponseEntityResultHandlerTests {
}
private
void
assertResponseBody
(
String
responseBody
)
{
Verifier
.
create
(
this
.
response
.
getBody
())
Step
Verifier
.
create
(
this
.
response
.
getBody
())
.
consumeNextWith
(
buf
->
assertEquals
(
responseBody
,
DataBufferTestUtils
.
dumpString
(
buf
,
StandardCharsets
.
UTF_8
)))
.
expectComplete
()
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/SessionAttributeMethodArgumentResolverTests.java
浏览文件 @
8705df50
...
...
@@ -21,7 +21,7 @@ import java.util.Optional;
import
org.junit.Before
;
import
org.junit.Test
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
org.springframework.core.DefaultParameterNameDiscoverer
;
...
...
@@ -96,7 +96,7 @@ public class SessionAttributeMethodArgumentResolverTests {
public
void
resolve
()
throws
Exception
{
MethodParameter
param
=
initMethodParameter
(
0
);
Mono
<
Object
>
mono
=
this
.
resolver
.
resolveArgument
(
param
,
new
BindingContext
(),
this
.
exchange
);
Verifier
.
create
(
mono
).
expectError
(
ServerWebInputException
.
class
).
verify
();
Step
Verifier
.
create
(
mono
).
expectError
(
ServerWebInputException
.
class
).
verify
();
Foo
foo
=
new
Foo
();
when
(
this
.
session
.
getAttribute
(
"foo"
)).
thenReturn
(
Optional
.
of
(
foo
));
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/SseIntegrationTests.java
浏览文件 @
8705df50
...
...
@@ -32,7 +32,7 @@ import org.springframework.http.codec.BodyExtractors;
import
org.springframework.http.codec.ServerSentEvent
;
import
org.springframework.http.server.reactive.AbstractHttpHandlerIntegrationTests
;
import
org.springframework.http.server.reactive.HttpHandler
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.client.reactive.ClientRequest
;
...
...
@@ -87,7 +87,7 @@ public class SseIntegrationTests extends AbstractHttpHandlerIntegrationTests {
.
map
(
s
->
(
s
.
replace
(
"\n"
,
""
)))
.
take
(
2
);
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
expectNext
(
"data:foo 0"
)
.
expectNext
(
"data:foo 1"
)
.
expectComplete
()
...
...
@@ -109,7 +109,7 @@ public class SseIntegrationTests extends AbstractHttpHandlerIntegrationTests {
.
takeUntil
(
s
->
s
.
endsWith
(
"foo 1\"}"
))
.
reduce
((
s1
,
s2
)
->
s1
+
s2
);
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
expectNext
(
"data:{\"name\":\"foo 0\"}data:{\"name\":\"foo 1\"}"
)
.
expectComplete
()
.
verify
(
Duration
.
ofSeconds
(
5L
));
...
...
@@ -129,7 +129,7 @@ public class SseIntegrationTests extends AbstractHttpHandlerIntegrationTests {
.
map
(
s
->
s
.
replace
(
"\n"
,
""
))
.
take
(
2
);
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
expectNext
(
"id:0:bardata:foo"
)
.
expectNext
(
"id:1:bardata:foo"
)
.
expectComplete
()
...
...
@@ -151,7 +151,7 @@ public class SseIntegrationTests extends AbstractHttpHandlerIntegrationTests {
.
map
(
s
->
s
.
replace
(
"\n"
,
""
))
.
take
(
2
);
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
expectNext
(
"id:0:bardata:foo"
)
.
expectNext
(
"id:1:bardata:foo"
)
.
expectComplete
()
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/view/HttpMessageWriterViewTests.java
浏览文件 @
8705df50
...
...
@@ -26,7 +26,7 @@ import java.util.List;
import
java.util.Map
;
import
org.junit.Test
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.core.codec.CharSequenceEncoder
;
import
org.springframework.core.io.buffer.DataBuffer
;
...
...
@@ -155,7 +155,7 @@ public class HttpMessageWriterViewTests {
this
.
view
.
render
(
this
.
model
,
MediaType
.
APPLICATION_JSON
,
exchange
);
Verifier
.
create
(
response
.
getBody
())
Step
Verifier
.
create
(
response
.
getBody
())
.
consumeNextWith
(
buf
->
assertEquals
(
"{\"foo\":\"f\",\"bar\":\"b\"}"
,
DataBufferTestUtils
.
dumpString
(
buf
,
StandardCharsets
.
UTF_8
))
)
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandlerTests.java
浏览文件 @
8705df50
...
...
@@ -31,7 +31,7 @@ import org.junit.Before;
import
org.junit.Test
;
import
reactor.core.publisher.Flux
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
rx.Completable
;
import
rx.Single
;
...
...
@@ -204,7 +204,7 @@ public class ViewResolutionResultHandlerTests {
this
.
request
.
setUri
(
"/path"
);
Mono
<
Void
>
mono
=
createResultHandler
().
handleResult
(
this
.
exchange
,
handlerResult
);
Verifier
.
create
(
mono
)
Step
Verifier
.
create
(
mono
)
.
expectNextCount
(
0
)
.
expectErrorWith
(
err
->
err
.
getMessage
().
equals
(
"Could not resolve view with name 'account'."
))
.
verify
();
...
...
@@ -240,7 +240,7 @@ public class ViewResolutionResultHandlerTests {
ViewResolutionResultHandler
resultHandler
=
createResultHandler
(
new
TestViewResolver
(
"account"
));
Mono
<
Void
>
mono
=
resultHandler
.
handleResult
(
this
.
exchange
,
handlerResult
);
Verifier
.
create
(
mono
)
Step
Verifier
.
create
(
mono
)
.
expectNextCount
(
0
)
.
expectError
(
NotAcceptableStatusException
.
class
)
.
verify
();
...
...
@@ -293,7 +293,7 @@ public class ViewResolutionResultHandlerTests {
}
private
void
assertResponseBody
(
String
responseBody
)
{
Verifier
.
create
(
this
.
response
.
getBody
())
Step
Verifier
.
create
(
this
.
response
.
getBody
())
.
consumeNextWith
(
buf
->
assertEquals
(
responseBody
,
DataBufferTestUtils
.
dumpString
(
buf
,
StandardCharsets
.
UTF_8
)))
.
expectComplete
()
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/view/freemarker/FreeMarkerViewTests.java
浏览文件 @
8705df50
...
...
@@ -25,7 +25,7 @@ import org.junit.Before;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.junit.rules.ExpectedException
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.context.ApplicationContextException
;
import
org.springframework.context.support.GenericApplicationContext
;
...
...
@@ -123,7 +123,7 @@ public class FreeMarkerViewTests {
model
.
addAttribute
(
"hello"
,
"hi FreeMarker"
);
view
.
render
(
model
,
null
,
this
.
exchange
);
Verifier
.
create
(
this
.
response
.
getBody
())
Step
Verifier
.
create
(
this
.
response
.
getBody
())
.
consumeNextWith
(
buf
->
{
assertEquals
(
"<html><body>hi FreeMarker</body></html>"
,
asString
(
buf
));
})
...
...
spring-web/src/test/java/org/springframework/http/codec/BodyExtractorsTests.java
浏览文件 @
8705df50
...
...
@@ -28,7 +28,7 @@ import org.junit.Before;
import
org.junit.Test
;
import
reactor.core.publisher.Flux
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.core.codec.ByteBufferDecoder
;
import
org.springframework.core.codec.StringDecoder
;
...
...
@@ -80,7 +80,7 @@ public class BodyExtractorsTests {
Mono
<
String
>
result
=
extractor
.
extract
(
request
,
this
.
context
);
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
expectNext
(
"foo"
)
.
expectComplete
()
.
verify
();
...
...
@@ -100,7 +100,7 @@ public class BodyExtractorsTests {
Flux
<
String
>
result
=
extractor
.
extract
(
request
,
this
.
context
);
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
expectNext
(
"foo"
)
.
expectComplete
()
.
verify
();
...
...
@@ -127,7 +127,7 @@ public class BodyExtractorsTests {
};
Flux
<
String
>
result
=
extractor
.
extract
(
request
,
emptyContext
);
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
expectError
(
UnsupportedMediaTypeException
.
class
)
.
verify
();
}
...
...
spring-web/src/test/java/org/springframework/http/codec/BodyInsertersTests.java
浏览文件 @
8705df50
...
...
@@ -28,7 +28,7 @@ import org.junit.Before;
import
org.junit.Test
;
import
reactor.core.publisher.Flux
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.core.codec.ByteBufferEncoder
;
import
org.springframework.core.codec.CharSequenceEncoder
;
...
...
@@ -85,11 +85,11 @@ public class BodyInsertersTests {
MockServerHttpResponse
response
=
new
MockServerHttpResponse
();
Mono
<
Void
>
result
=
inserter
.
insert
(
response
,
this
.
context
);
Verifier
.
create
(
result
).
expectComplete
().
verify
();
Step
Verifier
.
create
(
result
).
expectComplete
().
verify
();
ByteBuffer
byteBuffer
=
ByteBuffer
.
wrap
(
body
.
getBytes
(
UTF_8
));
DataBuffer
buffer
=
new
DefaultDataBufferFactory
().
wrap
(
byteBuffer
);
Verifier
.
create
(
response
.
getBody
())
Step
Verifier
.
create
(
response
.
getBody
())
.
expectNext
(
buffer
)
.
expectComplete
()
.
verify
();
...
...
@@ -104,11 +104,11 @@ public class BodyInsertersTests {
MockServerHttpResponse
response
=
new
MockServerHttpResponse
();
Mono
<
Void
>
result
=
inserter
.
insert
(
response
,
this
.
context
);
Verifier
.
create
(
result
).
expectComplete
().
verify
();
Step
Verifier
.
create
(
result
).
expectComplete
().
verify
();
ByteBuffer
byteBuffer
=
ByteBuffer
.
wrap
(
"foo"
.
getBytes
(
UTF_8
));
DataBuffer
buffer
=
new
DefaultDataBufferFactory
().
wrap
(
byteBuffer
);
Verifier
.
create
(
response
.
getBody
())
Step
Verifier
.
create
(
response
.
getBody
())
.
expectNext
(
buffer
)
.
expectComplete
()
.
verify
();
...
...
@@ -123,11 +123,11 @@ public class BodyInsertersTests {
MockServerHttpResponse
response
=
new
MockServerHttpResponse
();
Mono
<
Void
>
result
=
inserter
.
insert
(
response
,
this
.
context
);
Verifier
.
create
(
result
).
expectComplete
().
verify
();
Step
Verifier
.
create
(
result
).
expectComplete
().
verify
();
byte
[]
expectedBytes
=
Files
.
readAllBytes
(
body
.
getFile
().
toPath
());
Verifier
.
create
(
response
.
getBody
())
Step
Verifier
.
create
(
response
.
getBody
())
.
consumeNextWith
(
dataBuffer
->
{
byte
[]
resultBytes
=
new
byte
[
dataBuffer
.
readableByteCount
()];
dataBuffer
.
read
(
resultBytes
);
...
...
@@ -148,7 +148,7 @@ public class BodyInsertersTests {
MockServerHttpResponse
response
=
new
MockServerHttpResponse
();
Mono
<
Void
>
result
=
inserter
.
insert
(
response
,
this
.
context
);
Verifier
.
create
(
result
).
expectNextCount
(
0
).
expectComplete
().
verify
();
Step
Verifier
.
create
(
result
).
expectNextCount
(
0
).
expectComplete
().
verify
();
}
@Test
...
...
@@ -161,7 +161,7 @@ public class BodyInsertersTests {
MockServerHttpResponse
response
=
new
MockServerHttpResponse
();
Mono
<
Void
>
result
=
inserter
.
insert
(
response
,
this
.
context
);
Verifier
.
create
(
result
).
expectNextCount
(
0
).
expectComplete
().
verify
();
Step
Verifier
.
create
(
result
).
expectNextCount
(
0
).
expectComplete
().
verify
();
}
}
\ No newline at end of file
spring-web/src/test/java/org/springframework/http/codec/EncoderHttpMessageWriterTest.java
浏览文件 @
8705df50
...
...
@@ -21,7 +21,7 @@ import java.util.Collections;
import
org.jetbrains.annotations.NotNull
;
import
org.junit.Test
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.core.ResolvableType
;
import
org.springframework.core.codec.ByteBufferEncoder
;
...
...
@@ -68,7 +68,7 @@ public class EncoderHttpMessageWriterTest {
MediaType
.
APPLICATION_OCTET_STREAM
,
this
.
response
,
Collections
.
emptyMap
());
assertThat
(
this
.
response
.
getHeaders
().
getContentType
(),
is
(
MediaType
.
APPLICATION_OCTET_STREAM
));
Verifier
.
create
(
this
.
response
.
getBodyAsString
())
Step
Verifier
.
create
(
this
.
response
.
getBodyAsString
())
.
expectNext
(
payload
)
.
expectComplete
()
.
verify
();
...
...
spring-web/src/test/java/org/springframework/http/codec/ResourceHttpMessageWriterTests.java
浏览文件 @
8705df50
...
...
@@ -22,7 +22,7 @@ import java.util.Collections;
import
org.junit.Before
;
import
org.junit.Test
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.core.ResolvableType
;
import
org.springframework.core.io.ByteArrayResource
;
...
...
@@ -73,7 +73,7 @@ public class ResourceHttpMessageWriterTests {
Mono
<
Void
>
mono
=
this
.
writer
.
write
(
Mono
.
just
(
resource
),
null
,
ResolvableType
.
forClass
(
Resource
.
class
),
MediaType
.
TEXT_PLAIN
,
this
.
request
,
this
.
response
,
Collections
.
emptyMap
());
Verifier
.
create
(
mono
)
Step
Verifier
.
create
(
mono
)
.
expectNextCount
(
0
)
.
expectComplete
()
.
verify
();
...
...
@@ -83,7 +83,7 @@ public class ResourceHttpMessageWriterTests {
assertThat
(
this
.
response
.
getHeaders
().
getFirst
(
HttpHeaders
.
ACCEPT_RANGES
),
is
(
"bytes"
));
Mono
<
String
>
result
=
this
.
response
.
getBodyAsString
();
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
expectNext
(
"Spring Framework test resource content."
)
.
expectComplete
()
.
verify
();
...
...
@@ -94,7 +94,7 @@ public class ResourceHttpMessageWriterTests {
this
.
request
.
getHeaders
().
setRange
(
Collections
.
singletonList
(
HttpRange
.
createByteRange
(
0
,
5
)));
Mono
<
Void
>
mono
=
this
.
writer
.
write
(
Mono
.
just
(
resource
),
null
,
ResolvableType
.
forClass
(
Resource
.
class
),
MediaType
.
TEXT_PLAIN
,
this
.
request
,
this
.
response
,
Collections
.
emptyMap
());
Verifier
.
create
(
mono
)
Step
Verifier
.
create
(
mono
)
.
expectNextCount
(
0
)
.
expectComplete
()
.
verify
();
...
...
@@ -105,7 +105,7 @@ public class ResourceHttpMessageWriterTests {
assertThat
(
this
.
response
.
getHeaders
().
getContentLength
(),
is
(
6L
));
Mono
<
String
>
result
=
this
.
response
.
getBodyAsString
();
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
expectNext
(
"Spring"
)
.
expectComplete
()
.
verify
();
...
...
@@ -117,7 +117,7 @@ public class ResourceHttpMessageWriterTests {
Mono
<
Void
>
mono
=
this
.
writer
.
write
(
Mono
.
just
(
resource
),
null
,
ResolvableType
.
forClass
(
Resource
.
class
),
MediaType
.
TEXT_PLAIN
,
this
.
request
,
this
.
response
,
Collections
.
emptyMap
());
Verifier
.
create
(
mono
)
Step
Verifier
.
create
(
mono
)
.
expectNextCount
(
0
)
.
expectComplete
()
.
verify
();
...
...
spring-web/src/test/java/org/springframework/http/codec/ResourceRegionHttpMessageWriterTests.java
浏览文件 @
8705df50
...
...
@@ -28,7 +28,7 @@ import org.junit.Test;
import
org.junit.rules.ExpectedException
;
import
reactor.core.publisher.Flux
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.core.ResolvableType
;
import
org.springframework.core.io.ByteArrayResource
;
...
...
@@ -85,14 +85,14 @@ public class ResourceRegionHttpMessageWriterTests {
Mono
<
Void
>
mono
=
this
.
writer
.
write
(
Mono
.
just
(
region
),
ResolvableType
.
forClass
(
ResourceRegion
.
class
),
MediaType
.
TEXT_PLAIN
,
this
.
response
,
Collections
.
emptyMap
());
Verifier
.
create
(
mono
).
expectComplete
().
verify
();
Step
Verifier
.
create
(
mono
).
expectComplete
().
verify
();
assertThat
(
this
.
response
.
getHeaders
().
getContentType
(),
is
(
MediaType
.
TEXT_PLAIN
));
assertThat
(
this
.
response
.
getHeaders
().
getFirst
(
HttpHeaders
.
CONTENT_RANGE
),
is
(
"bytes 0-5/39"
));
assertThat
(
this
.
response
.
getHeaders
().
getContentLength
(),
is
(
6L
));
Mono
<
String
>
result
=
response
.
getBodyAsString
();
Verifier
.
create
(
result
).
expectNext
(
"Spring"
).
expectComplete
().
verify
();
Step
Verifier
.
create
(
result
).
expectNext
(
"Spring"
).
expectComplete
().
verify
();
}
@Test
...
...
@@ -109,14 +109,14 @@ public class ResourceRegionHttpMessageWriterTests {
Mono
<
Void
>
mono
=
this
.
writer
.
write
(
regions
,
ResolvableType
.
forClass
(
ResourceRegion
.
class
),
MediaType
.
TEXT_PLAIN
,
this
.
response
,
hints
);
Verifier
.
create
(
mono
).
expectComplete
().
verify
();
Step
Verifier
.
create
(
mono
).
expectComplete
().
verify
();
HttpHeaders
headers
=
this
.
response
.
getHeaders
();
assertThat
(
headers
.
getContentType
().
toString
(),
startsWith
(
"multipart/byteranges;boundary="
+
boundary
));
Mono
<
String
>
result
=
response
.
getBodyAsString
();
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
consumeNextWith
(
content
->
{
String
[]
ranges
=
StringUtils
.
tokenizeToStringArray
(
content
,
"\r\n"
,
false
,
true
);
...
...
spring-web/src/test/java/org/springframework/http/codec/ServerSentEventHttpMessageWriterTests.java
浏览文件 @
8705df50
...
...
@@ -24,7 +24,7 @@ import org.junit.Test;
import
org.reactivestreams.Publisher
;
import
reactor.core.publisher.Flux
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.core.ResolvableType
;
import
org.springframework.core.io.buffer.AbstractDataBufferAllocatingTestCase
;
...
...
@@ -73,7 +73,7 @@ public class ServerSentEventHttpMessageWriterTests extends AbstractDataBufferAll
new
MediaType
(
"text"
,
"event-stream"
),
outputMessage
,
Collections
.
emptyMap
());
Publisher
<
Publisher
<
DataBuffer
>>
result
=
Flux
.
from
(
outputMessage
.
getBodyWithFlush
());
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
consumeNextWith
(
sseConsumer
(
"id:c42\n"
+
"event:foo\n"
+
"retry:123\n"
+
":bla\n:bla bla\n:bla bla bla\n"
+
"data:bar\n"
))
.
expectComplete
()
...
...
@@ -88,7 +88,7 @@ public class ServerSentEventHttpMessageWriterTests extends AbstractDataBufferAll
new
MediaType
(
"text"
,
"event-stream"
),
outputMessage
,
Collections
.
emptyMap
());
Publisher
<
Publisher
<
DataBuffer
>>
result
=
outputMessage
.
getBodyWithFlush
();
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
consumeNextWith
(
sseConsumer
(
"data:foo\n"
))
.
consumeNextWith
(
sseConsumer
(
"data:bar\n"
))
.
expectComplete
()
...
...
@@ -103,7 +103,7 @@ public class ServerSentEventHttpMessageWriterTests extends AbstractDataBufferAll
new
MediaType
(
"text"
,
"event-stream"
),
outputMessage
,
Collections
.
emptyMap
());
Publisher
<
Publisher
<
DataBuffer
>>
result
=
outputMessage
.
getBodyWithFlush
();
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
consumeNextWith
(
sseConsumer
(
"data:foo\ndata:bar\n"
))
.
consumeNextWith
(
sseConsumer
(
"data:foo\ndata:baz\n"
))
.
expectComplete
()
...
...
@@ -119,7 +119,7 @@ public class ServerSentEventHttpMessageWriterTests extends AbstractDataBufferAll
new
MediaType
(
"text"
,
"event-stream"
),
outputMessage
,
Collections
.
emptyMap
());
Publisher
<
Publisher
<
DataBuffer
>>
result
=
outputMessage
.
getBodyWithFlush
();
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
consumeNextWith
(
sseConsumer
(
"data:"
,
"{\"foo\":\"foofoo\",\"bar\":\"barbar\"}"
,
"\n"
))
.
consumeNextWith
(
sseConsumer
(
"data:"
,
"{\"foo\":\"foofoofoo\",\"bar\":\"barbarbar\"}"
,
"\n"
))
.
expectComplete
()
...
...
@@ -128,7 +128,7 @@ public class ServerSentEventHttpMessageWriterTests extends AbstractDataBufferAll
private
Consumer
<
Publisher
<
DataBuffer
>>
sseConsumer
(
String
...
expected
)
{
return
publisher
->
{
Verifier
.
Step
builder
=
Verifier
.
create
(
publisher
);
StepVerifier
.
Step
builder
=
Step
Verifier
.
create
(
publisher
);
for
(
String
value
:
expected
)
{
builder
=
builder
.
consumeNextWith
(
stringConsumer
(
value
));
}
...
...
spring-web/src/test/java/org/springframework/http/codec/json/Jackson2JsonDecoderTests.java
浏览文件 @
8705df50
...
...
@@ -25,7 +25,7 @@ import com.fasterxml.jackson.annotation.JsonView;
import
org.junit.Test
;
import
reactor.core.publisher.Flux
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.core.ResolvableType
;
import
org.springframework.core.io.buffer.AbstractDataBufferAllocatingTestCase
;
...
...
@@ -61,7 +61,7 @@ public class Jackson2JsonDecoderTests extends AbstractDataBufferAllocatingTestCa
Flux
<
Object
>
flux
=
new
Jackson2JsonDecoder
().
decode
(
source
,
elementType
,
null
,
Collections
.
emptyMap
());
Verifier
.
create
(
flux
)
Step
Verifier
.
create
(
flux
)
.
expectNext
(
new
Pojo
(
"foofoo"
,
"barbar"
))
.
expectComplete
()
.
verify
();
...
...
@@ -76,7 +76,7 @@ public class Jackson2JsonDecoderTests extends AbstractDataBufferAllocatingTestCa
Mono
<
Object
>
mono
=
new
Jackson2JsonDecoder
().
decodeToMono
(
source
,
elementType
,
null
,
Collections
.
emptyMap
());
Verifier
.
create
(
mono
)
Step
Verifier
.
create
(
mono
)
.
expectNext
(
Arrays
.
asList
(
new
Pojo
(
"f1"
,
"b1"
),
new
Pojo
(
"f2"
,
"b2"
)))
.
expectComplete
()
.
verify
();
...
...
@@ -91,7 +91,7 @@ public class Jackson2JsonDecoderTests extends AbstractDataBufferAllocatingTestCa
Flux
<
Object
>
flux
=
new
Jackson2JsonDecoder
().
decode
(
source
,
elementType
,
null
,
Collections
.
emptyMap
());
Verifier
.
create
(
flux
)
Step
Verifier
.
create
(
flux
)
.
expectNext
(
new
Pojo
(
"f1"
,
"b1"
))
.
expectNext
(
new
Pojo
(
"f2"
,
"b2"
))
.
expectComplete
()
...
...
@@ -107,7 +107,7 @@ public class Jackson2JsonDecoderTests extends AbstractDataBufferAllocatingTestCa
Flux
<
JacksonViewBean
>
flux
=
new
Jackson2JsonDecoder
()
.
decode
(
source
,
elementType
,
null
,
hints
).
cast
(
JacksonViewBean
.
class
);
Verifier
.
create
(
flux
)
Step
Verifier
.
create
(
flux
)
.
consumeNextWith
(
b
->
{
assertTrue
(
b
.
getWithView1
().
equals
(
"with"
));
assertNull
(
b
.
getWithView2
());
...
...
@@ -124,7 +124,7 @@ public class Jackson2JsonDecoderTests extends AbstractDataBufferAllocatingTestCa
Mono
<
Object
>
mono
=
new
Jackson2JsonDecoder
().
decodeToMono
(
source
,
elementType
,
null
,
Collections
.
emptyMap
());
Verifier
.
create
(
mono
)
Step
Verifier
.
create
(
mono
)
.
expectNextCount
(
0
)
.
expectComplete
()
.
verify
();
...
...
spring-web/src/test/java/org/springframework/http/codec/json/Jackson2JsonEncoderTests.java
浏览文件 @
8705df50
...
...
@@ -25,7 +25,7 @@ import com.fasterxml.jackson.annotation.JsonView;
import
org.junit.Test
;
import
reactor.core.publisher.Flux
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.core.ResolvableType
;
import
org.springframework.core.io.buffer.AbstractDataBufferAllocatingTestCase
;
...
...
@@ -65,7 +65,7 @@ public class Jackson2JsonEncoderTests extends AbstractDataBufferAllocatingTestCa
ResolvableType
type
=
ResolvableType
.
forClass
(
Pojo
.
class
);
Flux
<
DataBuffer
>
output
=
this
.
encoder
.
encode
(
source
,
this
.
bufferFactory
,
type
,
null
,
Collections
.
emptyMap
());
Verifier
.
create
(
output
)
Step
Verifier
.
create
(
output
)
.
consumeNextWith
(
stringConsumer
(
"["
))
.
consumeNextWith
(
stringConsumer
(
"{\"foo\":\"foo\",\"bar\":\"bar\"}"
))
.
consumeNextWith
(
stringConsumer
(
","
))
...
...
@@ -83,7 +83,7 @@ public class Jackson2JsonEncoderTests extends AbstractDataBufferAllocatingTestCa
ResolvableType
type
=
ResolvableType
.
forClass
(
ParentClass
.
class
);
Flux
<
DataBuffer
>
output
=
this
.
encoder
.
encode
(
source
,
this
.
bufferFactory
,
type
,
null
,
Collections
.
emptyMap
());
Verifier
.
create
(
output
)
Step
Verifier
.
create
(
output
)
.
consumeNextWith
(
stringConsumer
(
"["
))
.
consumeNextWith
(
stringConsumer
(
"{\"type\":\"foo\"}"
))
.
consumeNextWith
(
stringConsumer
(
","
))
...
...
@@ -104,7 +104,7 @@ public class Jackson2JsonEncoderTests extends AbstractDataBufferAllocatingTestCa
Map
<
String
,
Object
>
hints
=
Collections
.
singletonMap
(
Jackson2JsonEncoder
.
JSON_VIEW_HINT
,
MyJacksonView1
.
class
);
Flux
<
DataBuffer
>
output
=
this
.
encoder
.
encode
(
Mono
.
just
(
bean
),
this
.
bufferFactory
,
type
,
null
,
hints
);
Verifier
.
create
(
output
)
Step
Verifier
.
create
(
output
)
.
consumeNextWith
(
stringConsumer
(
"{\"withView1\":\"with\"}"
))
.
expectComplete
()
.
verify
();
...
...
spring-web/src/test/java/org/springframework/http/codec/json/JsonObjectDecoderTests.java
浏览文件 @
8705df50
...
...
@@ -21,7 +21,7 @@ import java.util.Collections;
import
org.junit.Test
;
import
reactor.core.publisher.Flux
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.core.io.buffer.AbstractDataBufferAllocatingTestCase
;
import
org.springframework.core.io.buffer.DataBuffer
;
...
...
@@ -38,7 +38,7 @@ public class JsonObjectDecoderTests extends AbstractDataBufferAllocatingTestCase
Flux
.
just
(
stringBuffer
(
"{\"foo\": \"foofoo\", \"bar\": \"barbar\"}"
));
Flux
<
String
>
output
=
decoder
.
decode
(
source
,
null
,
null
,
Collections
.
emptyMap
()).
map
(
JsonObjectDecoderTests:
:
toString
);
Verifier
.
create
(
output
)
Step
Verifier
.
create
(
output
)
.
expectNext
(
"{\"foo\": \"foofoo\", \"bar\": \"barbar\"}"
)
.
expectComplete
()
.
verify
();
...
...
@@ -51,7 +51,7 @@ public class JsonObjectDecoderTests extends AbstractDataBufferAllocatingTestCase
stringBuffer
(
", \"bar\": \"barbar\"}"
));
Flux
<
String
>
output
=
decoder
.
decode
(
source
,
null
,
null
,
Collections
.
emptyMap
()).
map
(
JsonObjectDecoderTests:
:
toString
);
Verifier
.
create
(
output
)
Step
Verifier
.
create
(
output
)
.
expectNext
(
"{\"foo\": \"foofoo\", \"bar\": \"barbar\"}"
)
.
expectComplete
()
.
verify
();
...
...
@@ -65,7 +65,7 @@ public class JsonObjectDecoderTests extends AbstractDataBufferAllocatingTestCase
"[{\"foo\": \"foofoo\", \"bar\": \"barbar\"},{\"foo\": \"foofoofoo\", \"bar\": \"barbarbar\"}]"
));
Flux
<
String
>
output
=
decoder
.
decode
(
source
,
null
,
null
,
Collections
.
emptyMap
()).
map
(
JsonObjectDecoderTests:
:
toString
);
Verifier
.
create
(
output
)
Step
Verifier
.
create
(
output
)
.
expectNext
(
"{\"foo\": \"foofoo\", \"bar\": \"barbar\"}"
)
.
expectNext
(
"{\"foo\": \"foofoofoo\", \"bar\": \"barbarbar\"}"
)
.
expectComplete
()
...
...
@@ -73,7 +73,7 @@ public class JsonObjectDecoderTests extends AbstractDataBufferAllocatingTestCase
source
=
Flux
.
just
(
stringBuffer
(
"[{\"foo\": \"bar\"},{\"foo\": \"baz\"}]"
));
output
=
decoder
.
decode
(
source
,
null
,
null
,
Collections
.
emptyMap
()).
map
(
JsonObjectDecoderTests:
:
toString
);
Verifier
.
create
(
output
)
Step
Verifier
.
create
(
output
)
.
expectNext
(
"{\"foo\": \"bar\"}"
)
.
expectNext
(
"{\"foo\": \"baz\"}"
)
.
expectComplete
()
...
...
@@ -89,7 +89,7 @@ public class JsonObjectDecoderTests extends AbstractDataBufferAllocatingTestCase
": \"barbar\"},{\"foo\": \"foofoofoo\", \"bar\": \"barbarbar\"}]"
));
Flux
<
String
>
output
=
decoder
.
decode
(
source
,
null
,
null
,
Collections
.
emptyMap
()).
map
(
JsonObjectDecoderTests:
:
toString
);
Verifier
.
create
(
output
)
Step
Verifier
.
create
(
output
)
.
expectNext
(
"{\"foo\": \"foofoo\", \"bar\": \"barbar\"}"
)
.
expectNext
(
"{\"foo\": \"foofoofoo\", \"bar\": \"barbarbar\"}"
)
.
expectComplete
()
...
...
@@ -101,7 +101,7 @@ public class JsonObjectDecoderTests extends AbstractDataBufferAllocatingTestCase
stringBuffer
(
"o\": \"baz\"}"
),
stringBuffer
(
"]"
));
output
=
decoder
.
decode
(
source
,
null
,
null
,
Collections
.
emptyMap
()).
map
(
JsonObjectDecoderTests:
:
toString
);
Verifier
.
create
(
output
)
Step
Verifier
.
create
(
output
)
.
expectNext
(
"{\"foo\": \"bar\"}"
)
.
expectNext
(
"{\"foo\": \"baz\"}"
)
.
expectComplete
()
...
...
spring-web/src/test/java/org/springframework/http/codec/xml/Jaxb2XmlDecoderTests.java
浏览文件 @
8705df50
...
...
@@ -23,7 +23,7 @@ import javax.xml.stream.events.XMLEvent;
import
org.junit.Test
;
import
reactor.core.publisher.Flux
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.core.ResolvableType
;
import
org.springframework.core.io.buffer.AbstractDataBufferAllocatingTestCase
;
...
...
@@ -91,7 +91,7 @@ public class Jaxb2XmlDecoderTests extends AbstractDataBufferAllocatingTestCase {
.
decode
(
Flux
.
just
(
stringBuffer
(
POJO_ROOT
)),
null
,
null
,
Collections
.
emptyMap
());
Flux
<
List
<
XMLEvent
>>
result
=
this
.
decoder
.
split
(
xmlEvents
,
new
QName
(
"pojo"
));
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
consumeNextWith
(
events
->
{
assertEquals
(
8
,
events
.
size
());
assertStartElement
(
events
.
get
(
0
),
"pojo"
);
...
...
@@ -114,7 +114,7 @@ public class Jaxb2XmlDecoderTests extends AbstractDataBufferAllocatingTestCase {
Flux
<
List
<
XMLEvent
>>
result
=
this
.
decoder
.
split
(
xmlEvents
,
new
QName
(
"pojo"
));
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
consumeNextWith
(
events
->
{
assertEquals
(
8
,
events
.
size
());
assertStartElement
(
events
.
get
(
0
),
"pojo"
);
...
...
@@ -162,7 +162,7 @@ public class Jaxb2XmlDecoderTests extends AbstractDataBufferAllocatingTestCase {
Flux
<
Object
>
output
=
this
.
decoder
.
decode
(
source
,
ResolvableType
.
forClass
(
Pojo
.
class
),
null
,
Collections
.
emptyMap
());
Verifier
.
create
(
output
)
Step
Verifier
.
create
(
output
)
.
expectNext
(
new
Pojo
(
"foofoo"
,
"barbar"
))
.
expectComplete
()
.
verify
();
...
...
@@ -174,7 +174,7 @@ public class Jaxb2XmlDecoderTests extends AbstractDataBufferAllocatingTestCase {
Flux
<
Object
>
output
=
this
.
decoder
.
decode
(
source
,
ResolvableType
.
forClass
(
TypePojo
.
class
),
null
,
Collections
.
emptyMap
());
Verifier
.
create
(
output
)
Step
Verifier
.
create
(
output
)
.
expectNext
(
new
TypePojo
(
"foofoo"
,
"barbar"
))
.
expectComplete
()
.
verify
();
...
...
@@ -186,7 +186,7 @@ public class Jaxb2XmlDecoderTests extends AbstractDataBufferAllocatingTestCase {
Flux
<
Object
>
output
=
this
.
decoder
.
decode
(
source
,
ResolvableType
.
forClass
(
Pojo
.
class
),
null
,
Collections
.
emptyMap
());
Verifier
.
create
(
output
)
Step
Verifier
.
create
(
output
)
.
expectNext
(
new
Pojo
(
"foo"
,
"bar"
))
.
expectNext
(
new
Pojo
(
"foofoo"
,
"barbar"
))
.
expectComplete
()
...
...
@@ -199,7 +199,7 @@ public class Jaxb2XmlDecoderTests extends AbstractDataBufferAllocatingTestCase {
Flux
<
Object
>
output
=
this
.
decoder
.
decode
(
source
,
ResolvableType
.
forClass
(
TypePojo
.
class
),
null
,
Collections
.
emptyMap
());
Verifier
.
create
(
output
)
Step
Verifier
.
create
(
output
)
.
expectNext
(
new
TypePojo
(
"foo"
,
"bar"
))
.
expectNext
(
new
TypePojo
(
"foofoo"
,
"barbar"
))
.
expectComplete
()
...
...
spring-web/src/test/java/org/springframework/http/codec/xml/Jaxb2XmlEncoderTests.java
浏览文件 @
8705df50
...
...
@@ -21,7 +21,7 @@ import java.util.Collections;
import
org.junit.Test
;
import
reactor.core.publisher.Flux
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.core.ResolvableType
;
import
org.springframework.core.io.buffer.AbstractDataBufferAllocatingTestCase
;
...
...
@@ -69,7 +69,7 @@ public class Jaxb2XmlEncoderTests extends AbstractDataBufferAllocatingTestCase {
ResolvableType
.
forClass
(
Pojo
.
class
),
MediaType
.
APPLICATION_XML
,
Collections
.
emptyMap
());
Verifier
.
create
(
output
)
Step
Verifier
.
create
(
output
)
.
consumeNextWith
(
dataBuffer
->
{
try
{
String
s
=
DataBufferTestUtils
...
...
spring-web/src/test/java/org/springframework/http/codec/xml/XmlEventDecoderTests.java
浏览文件 @
8705df50
...
...
@@ -21,7 +21,7 @@ import javax.xml.stream.events.XMLEvent;
import
org.junit.Test
;
import
reactor.core.publisher.Flux
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.core.io.buffer.AbstractDataBufferAllocatingTestCase
;
...
...
@@ -47,7 +47,7 @@ public class XmlEventDecoderTests extends AbstractDataBufferAllocatingTestCase {
Flux
<
XMLEvent
>
events
=
this
.
decoder
.
decode
(
Flux
.
just
(
stringBuffer
(
XML
)),
null
,
null
,
Collections
.
emptyMap
());
Verifier
.
create
(
events
)
Step
Verifier
.
create
(
events
)
.
consumeNextWith
(
e
->
assertTrue
(
e
.
isStartDocument
()))
.
consumeNextWith
(
e
->
assertStartElement
(
e
,
"pojo"
))
.
consumeNextWith
(
e
->
assertStartElement
(
e
,
"foo"
))
...
...
@@ -68,7 +68,7 @@ public class XmlEventDecoderTests extends AbstractDataBufferAllocatingTestCase {
Flux
<
XMLEvent
>
events
=
this
.
decoder
.
decode
(
Flux
.
just
(
stringBuffer
(
XML
)),
null
,
null
,
Collections
.
emptyMap
());
Verifier
.
create
(
events
)
Step
Verifier
.
create
(
events
)
.
consumeNextWith
(
e
->
assertTrue
(
e
.
isStartDocument
()))
.
consumeNextWith
(
e
->
assertStartElement
(
e
,
"pojo"
))
.
consumeNextWith
(
e
->
assertStartElement
(
e
,
"foo"
))
...
...
spring-web/src/test/java/org/springframework/http/server/reactive/FlushingIntegrationTests.java
浏览文件 @
8705df50
...
...
@@ -23,7 +23,7 @@ import org.junit.Test;
import
org.reactivestreams.Publisher
;
import
reactor.core.publisher.Flux
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.core.io.buffer.DataBuffer
;
import
org.springframework.http.client.reactive.ReactorClientHttpConnector
;
...
...
@@ -56,7 +56,7 @@ public class FlushingIntegrationTests extends AbstractHttpHandlerIntegrationTest
.
takeUntil
(
s
->
s
.
endsWith
(
"data1"
))
.
reduce
((
s1
,
s2
)
->
s1
+
s2
);
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
expectNext
(
"data0data1"
)
.
expectComplete
()
.
verify
(
Duration
.
ofSeconds
(
5L
));
...
...
spring-web/src/test/java/org/springframework/web/client/reactive/ExchangeFilterFunctionsTests.java
浏览文件 @
8705df50
...
...
@@ -20,7 +20,7 @@ import java.util.Optional;
import
org.junit.Test
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpStatus
;
...
...
@@ -97,7 +97,7 @@ public class ExchangeFilterFunctionsTests {
Mono
<
ClientResponse
>
result
=
standardErrors
.
filter
(
request
,
exchange
);
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
expectNext
(
response
)
.
expectComplete
()
.
verify
();
...
...
@@ -114,7 +114,7 @@ public class ExchangeFilterFunctionsTests {
Mono
<
ClientResponse
>
result
=
standardErrors
.
filter
(
request
,
exchange
);
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
expectError
(
WebClientException
.
class
)
.
verify
();
}
...
...
@@ -131,7 +131,7 @@ public class ExchangeFilterFunctionsTests {
Mono
<
ClientResponse
>
result
=
errorPredicate
.
filter
(
request
,
exchange
);
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
expectError
(
WebClientException
.
class
)
.
verify
();
}
...
...
@@ -148,7 +148,7 @@ public class ExchangeFilterFunctionsTests {
Mono
<
ClientResponse
>
result
=
errorMapper
.
filter
(
request
,
exchange
);
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
expectError
(
IllegalStateException
.
class
)
.
verify
();
}
...
...
spring-web/src/test/java/org/springframework/web/client/reactive/WebClientIntegrationTests.java
浏览文件 @
8705df50
...
...
@@ -28,7 +28,7 @@ import org.junit.Before;
import
org.junit.Test
;
import
reactor.core.publisher.Flux
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpStatus
;
...
...
@@ -70,7 +70,7 @@ public class WebClientIntegrationTests {
.
exchange
(
request
)
.
map
(
response
->
response
.
headers
().
asHttpHeaders
());
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
consumeNextWith
(
httpHeaders
->
{
assertEquals
(
MediaType
.
TEXT_PLAIN
,
httpHeaders
.
getContentType
());
...
...
@@ -98,7 +98,7 @@ public class WebClientIntegrationTests {
.
exchange
(
request
)
.
then
(
response
->
response
.
body
(
toMono
(
String
.
class
)));
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
expectNext
(
"Hello Spring!"
)
.
expectComplete
()
.
verify
();
...
...
@@ -120,7 +120,7 @@ public class WebClientIntegrationTests {
Mono
<
String
>
result
=
this
.
webClient
.
retrieveMono
(
request
,
String
.
class
);
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
expectNext
(
"Hello Spring!"
)
.
expectComplete
()
.
verify
();
...
...
@@ -141,7 +141,7 @@ public class WebClientIntegrationTests {
Flux
<
String
>
result
=
this
.
webClient
.
retrieveFlux
(
request
,
String
.
class
);
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
expectNext
(
"Hello Spring!"
)
.
expectComplete
()
.
verify
();
...
...
@@ -167,7 +167,7 @@ public class WebClientIntegrationTests {
.
exchange
(
request
)
.
then
(
response
->
response
.
body
(
toMono
(
String
.
class
)));
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
expectNext
(
content
)
.
expectComplete
()
.
verify
();
...
...
@@ -192,7 +192,7 @@ public class WebClientIntegrationTests {
.
exchange
(
request
)
.
then
(
response
->
response
.
body
(
toMono
(
Pojo
.
class
)));
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
consumeNextWith
(
p
->
assertEquals
(
"barbar"
,
p
.
getBar
()))
.
expectComplete
()
.
verify
();
...
...
@@ -217,7 +217,7 @@ public class WebClientIntegrationTests {
.
exchange
(
request
)
.
flatMap
(
response
->
response
.
body
(
toFlux
(
Pojo
.
class
)));
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
consumeNextWith
(
p
->
assertThat
(
p
.
getBar
(),
Matchers
.
is
(
"bar1"
)))
.
consumeNextWith
(
p
->
assertThat
(
p
.
getBar
(),
Matchers
.
is
(
"bar2"
)))
.
expectComplete
()
...
...
@@ -246,7 +246,7 @@ public class WebClientIntegrationTests {
.
exchange
(
request
)
.
then
(
response
->
response
.
body
(
BodyExtractors
.
toMono
(
Pojo
.
class
)));
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
consumeNextWith
(
p
->
assertEquals
(
"BARBAR"
,
p
.
getBar
()))
.
expectComplete
()
.
verify
();
...
...
@@ -274,7 +274,7 @@ public class WebClientIntegrationTests {
.
exchange
(
request
)
.
then
(
response
->
response
.
body
(
toMono
(
String
.
class
)));
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
expectNext
(
"test"
)
.
expectComplete
()
.
verify
();
...
...
@@ -296,7 +296,7 @@ public class WebClientIntegrationTests {
Mono
<
ClientResponse
>
result
=
this
.
webClient
.
exchange
(
request
);
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
consumeNextWith
(
response
->
{
assertEquals
(
HttpStatus
.
NOT_FOUND
,
response
.
statusCode
());
})
...
...
@@ -320,7 +320,7 @@ public class WebClientIntegrationTests {
Mono
<
String
>
result
=
this
.
webClient
.
retrieveMono
(
request
,
String
.
class
);
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
expectError
(
WebClientException
.
class
)
.
verify
(
Duration
.
ofSeconds
(
3
));
...
...
@@ -341,7 +341,7 @@ public class WebClientIntegrationTests {
Mono
<
String
>
result
=
this
.
webClient
.
retrieveMono
(
request
,
String
.
class
);
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
expectError
(
WebClientException
.
class
)
.
verify
(
Duration
.
ofSeconds
(
3
));
...
...
@@ -369,7 +369,7 @@ public class WebClientIntegrationTests {
Mono
<
String
>
result
=
filteredClient
.
exchange
(
request
)
.
then
(
response
->
response
.
body
(
toMono
(
String
.
class
)));
Verifier
.
create
(
result
)
Step
Verifier
.
create
(
result
)
.
expectNext
(
"Hello Spring!"
)
.
expectComplete
()
.
verify
();
...
...
spring-web/src/test/java/org/springframework/web/server/handler/ResponseStatusExceptionHandlerTests.java
浏览文件 @
8705df50
...
...
@@ -21,7 +21,7 @@ import java.time.Duration;
import
org.junit.Before
;
import
org.junit.Test
;
import
reactor.core.publisher.Mono
;
import
reactor.test.
subscriber.
Verifier
;
import
reactor.test.
Step
Verifier
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.http.HttpStatus
;
...
...
@@ -72,7 +72,7 @@ public class ResponseStatusExceptionHandlerTests {
Throwable
expected
=
new
IllegalStateException
();
Mono
<
Void
>
mono
=
this
.
handler
.
handle
(
this
.
exchange
,
expected
);
Verifier
.
create
(
mono
)
Step
Verifier
.
create
(
mono
)
.
consumeErrorWith
(
actual
->
assertSame
(
expected
,
actual
))
.
verify
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录