Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Meiracle
spring-framework
提交
7f422f20
S
spring-framework
项目概览
Meiracle
/
spring-framework
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
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,发现更多精彩内容 >>
提交
7f422f20
编写于
3月 15, 2021
作者:
R
Rebwon
提交者:
Sam Brannen
3月 15, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polishing
Closes gh-26682
上级
70f0895f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
21 addition
and
20 deletion
+21
-20
spring-test/src/test/java/org/springframework/mock/web/MockFilterChainTests.java
...va/org/springframework/mock/web/MockFilterChainTests.java
+2
-2
spring-test/src/test/java/org/springframework/mock/web/MockHttpServletRequestTests.java
...springframework/mock/web/MockHttpServletRequestTests.java
+7
-6
spring-test/src/test/java/org/springframework/test/web/servlet/setup/StandaloneMockMvcBuilderTests.java
...test/web/servlet/setup/StandaloneMockMvcBuilderTests.java
+12
-12
未找到文件。
spring-test/src/test/java/org/springframework/mock/web/MockFilterChainTests.java
浏览文件 @
7f422f20
/*
* Copyright 2002-20
19
the original author or authors.
* Copyright 2002-20
21
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -55,7 +55,7 @@ class MockFilterChainTests {
@Test
void
constructorNullServlet
()
{
assertThatIllegalArgumentException
().
isThrownBy
(()
->
new
MockFilterChain
(
(
Servlet
)
null
));
new
MockFilterChain
(
null
));
}
@Test
...
...
spring-test/src/test/java/org/springframework/mock/web/MockHttpServletRequestTests.java
浏览文件 @
7f422f20
/*
* Copyright 2002-202
0
the original author or authors.
* Copyright 2002-202
1
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -19,6 +19,7 @@ package org.springframework.mock.web;
import
java.io.IOException
;
import
java.net.URL
;
import
java.nio.charset.Charset
;
import
java.nio.charset.StandardCharsets
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collections
;
...
...
@@ -112,7 +113,7 @@ class MockHttpServletRequestTests {
@Test
void
setContentAndGetContentAsStringWithExplicitCharacterEncoding
()
throws
IOException
{
String
palindrome
=
"ablE was I ere I saw Elba"
;
byte
[]
bytes
=
palindrome
.
getBytes
(
"UTF-16"
);
byte
[]
bytes
=
palindrome
.
getBytes
(
StandardCharsets
.
UTF_16
);
request
.
setCharacterEncoding
(
"UTF-16"
);
request
.
setContent
(
bytes
);
assertThat
(
request
.
getContentLength
()).
isEqualTo
(
bytes
.
length
);
...
...
@@ -394,7 +395,7 @@ class MockHttpServletRequestTests {
void
getServerNameWithInvalidIpv6AddressViaHostHeader
()
{
request
.
addHeader
(
HOST
,
"[::ffff:abcd:abcd"
);
// missing closing bracket
assertThatIllegalStateException
()
.
isThrownBy
(
()
->
request
.
getServerName
()
)
.
isThrownBy
(
request:
:
getServerName
)
.
withMessageStartingWith
(
"Invalid Host header: "
);
}
...
...
@@ -426,7 +427,7 @@ class MockHttpServletRequestTests {
void
getServerPortWithInvalidIpv6AddressViaHostHeader
()
{
request
.
addHeader
(
HOST
,
"[::ffff:abcd:abcd:8080"
);
// missing closing bracket
assertThatIllegalStateException
()
.
isThrownBy
(
()
->
request
.
getServerPort
()
)
.
isThrownBy
(
request:
:
getServerPort
)
.
withMessageStartingWith
(
"Invalid Host header: "
);
}
...
...
@@ -434,7 +435,7 @@ class MockHttpServletRequestTests {
void
getServerPortWithIpv6AddressAndInvalidPortViaHostHeader
()
{
request
.
addHeader
(
HOST
,
"[::ffff:abcd:abcd]:bogus"
);
// "bogus" is not a port number
assertThatExceptionOfType
(
NumberFormatException
.
class
)
.
isThrownBy
(
()
->
request
.
getServerPort
()
)
.
isThrownBy
(
request:
:
getServerPort
)
.
withMessageContaining
(
"bogus"
);
}
...
...
@@ -521,7 +522,7 @@ class MockHttpServletRequestTests {
void
getRequestURLWithInvalidIpv6AddressViaHostHeader
()
{
request
.
addHeader
(
HOST
,
"[::ffff:abcd:abcd"
);
// missing closing bracket
assertThatIllegalStateException
()
.
isThrownBy
(
()
->
request
.
getRequestURL
()
)
.
isThrownBy
(
request:
:
getRequestURL
)
.
withMessageStartingWith
(
"Invalid Host header: "
);
}
...
...
spring-test/src/test/java/org/springframework/test/web/servlet/setup/StandaloneMockMvcBuilderTests.java
浏览文件 @
7f422f20
/*
* Copyright 2002-20
19
the original author or authors.
* Copyright 2002-20
21
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -49,10 +49,10 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
* @author Rob Winch
* @author Sebastien Deleuze
*/
public
class
StandaloneMockMvcBuilderTests
{
class
StandaloneMockMvcBuilderTests
{
@Test
// SPR-10825
public
void
placeHoldersInRequestMapping
()
throws
Exception
{
void
placeHoldersInRequestMapping
()
throws
Exception
{
TestStandaloneMockMvcBuilder
builder
=
new
TestStandaloneMockMvcBuilder
(
new
PlaceholderController
());
builder
.
addPlaceholderValue
(
"sys.login.ajax"
,
"/foo"
);
builder
.
build
();
...
...
@@ -68,7 +68,7 @@ public class StandaloneMockMvcBuilderTests {
@Test
// SPR-13637
@SuppressWarnings
(
"deprecation"
)
public
void
suffixPatternMatch
()
throws
Exception
{
void
suffixPatternMatch
()
throws
Exception
{
TestStandaloneMockMvcBuilder
builder
=
new
TestStandaloneMockMvcBuilder
(
new
PersonController
());
builder
.
setUseSuffixPatternMatch
(
false
);
builder
.
build
();
...
...
@@ -86,7 +86,7 @@ public class StandaloneMockMvcBuilderTests {
}
@Test
// SPR-12553
public
void
applicationContextAttribute
()
{
void
applicationContextAttribute
()
{
TestStandaloneMockMvcBuilder
builder
=
new
TestStandaloneMockMvcBuilder
(
new
PlaceholderController
());
builder
.
addPlaceholderValue
(
"sys.login.ajax"
,
"/foo"
);
WebApplicationContext
wac
=
builder
.
initWebAppContext
();
...
...
@@ -94,28 +94,28 @@ public class StandaloneMockMvcBuilderTests {
}
@Test
public
void
addFiltersFiltersNull
()
{
void
addFiltersFiltersNull
()
{
StandaloneMockMvcBuilder
builder
=
MockMvcBuilders
.
standaloneSetup
(
new
PersonController
());
assertThatIllegalArgumentException
().
isThrownBy
(()
->
builder
.
addFilters
((
Filter
[])
null
));
}
@Test
public
void
addFiltersFiltersContainsNull
()
{
void
addFiltersFiltersContainsNull
()
{
StandaloneMockMvcBuilder
builder
=
MockMvcBuilders
.
standaloneSetup
(
new
PersonController
());
assertThatIllegalArgumentException
().
isThrownBy
(()
->
builder
.
addFilters
(
new
ContinueFilter
(),
(
Filter
)
null
));
builder
.
addFilters
(
new
ContinueFilter
(),
null
));
}
@Test
public
void
addFilterPatternsNull
()
{
void
addFilterPatternsNull
()
{
StandaloneMockMvcBuilder
builder
=
MockMvcBuilders
.
standaloneSetup
(
new
PersonController
());
assertThatIllegalArgumentException
().
isThrownBy
(()
->
builder
.
addFilter
(
new
ContinueFilter
(),
(
String
[])
null
));
}
@Test
public
void
addFilterPatternContainsNull
()
{
void
addFilterPatternContainsNull
()
{
StandaloneMockMvcBuilder
builder
=
MockMvcBuilders
.
standaloneSetup
(
new
PersonController
());
assertThatIllegalArgumentException
().
isThrownBy
(()
->
builder
.
addFilter
(
new
ContinueFilter
(),
(
String
)
null
));
...
...
@@ -123,7 +123,7 @@ public class StandaloneMockMvcBuilderTests {
@Test
// SPR-13375
@SuppressWarnings
(
"rawtypes"
)
public
void
springHandlerInstantiator
()
{
void
springHandlerInstantiator
()
{
TestStandaloneMockMvcBuilder
builder
=
new
TestStandaloneMockMvcBuilder
(
new
PersonController
());
builder
.
build
();
SpringHandlerInstantiator
instantiator
=
new
SpringHandlerInstantiator
(
builder
.
wac
.
getAutowireCapableBeanFactory
());
...
...
@@ -171,7 +171,7 @@ public class StandaloneMockMvcBuilderTests {
}
private
class
ContinueFilter
extends
OncePerRequestFilter
{
private
static
class
ContinueFilter
extends
OncePerRequestFilter
{
@Override
protected
void
doFilterInternal
(
HttpServletRequest
request
,
HttpServletResponse
response
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录