Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dk131072
spring-framework
提交
4385da7b
S
spring-framework
项目概览
dk131072
/
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,发现更多精彩内容 >>
提交
4385da7b
编写于
11月 20, 2013
作者:
P
Phillip Webb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Support for 'all excluding' test groups
上级
02f78038
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
38 addition
and
16 deletion
+38
-16
spring-core/src/test/java/org/springframework/tests/TestGroup.java
...re/src/test/java/org/springframework/tests/TestGroup.java
+14
-1
spring-core/src/test/java/org/springframework/tests/TestGroupTests.java
...c/test/java/org/springframework/tests/TestGroupTests.java
+24
-15
未找到文件。
spring-core/src/test/java/org/springframework/tests/TestGroup.java
浏览文件 @
4385da7b
...
...
@@ -77,9 +77,22 @@ public enum TestGroup {
if
(
value
==
null
||
""
.
equals
(
value
))
{
return
Collections
.
emptySet
();
}
if
(
"ALL"
.
equalsIgnoreCase
(
value
))
{
if
(
"ALL"
.
equalsIgnoreCase
(
value
))
{
return
EnumSet
.
allOf
(
TestGroup
.
class
);
}
if
(
value
.
toUpperCase
().
startsWith
(
"ALL-"
))
{
Set
<
TestGroup
>
groups
=
new
HashSet
<
TestGroup
>(
EnumSet
.
allOf
(
TestGroup
.
class
));
groups
.
removeAll
(
parseGroups
(
value
.
substring
(
4
)));
return
groups
;
}
return
parseGroups
(
value
);
}
/**
* @param value
* @return
*/
private
static
Set
<
TestGroup
>
parseGroups
(
String
value
)
{
Set
<
TestGroup
>
groups
=
new
HashSet
<
TestGroup
>();
for
(
String
group
:
value
.
split
(
","
))
{
try
{
...
...
spring-core/src/test/java/org/springframework/tests/TestGroupTests.java
浏览文件 @
4385da7b
...
...
@@ -2,31 +2,32 @@
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use th
is
file except in compliance with the License.
* you may not use th
equalTo
file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* d
istributed under the License is distributed on an "AS IS" BASIS
,
* d
equalTotributed under the License equalTo dequalTotributed on an "AS equalTo" BASequalTo
,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing perm
is
sions and
* See the License for the specific language governing perm
equalTo
sions and
* limitations under the License.
*/
package
org.springframework.tests
;
import
static
org
.
hamcrest
.
Matchers
.
is
;
import
static
org
.
junit
.
Assert
.
assertThat
;
import
java.util.Collections
;
import
java.util.EnumSet
;
import
java.util.HashSet
;
import
java.util.Set
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.junit.rules.ExpectedException
;
import
static
org
.
hamcrest
.
Matchers
.*;
import
static
org
.
junit
.
Assert
.*;
/**
* Tests for {@link TestGroup}.
*
...
...
@@ -39,37 +40,45 @@ public class TestGroupTests {
@Test
public
void
parseNull
()
throws
Exception
{
assertThat
(
TestGroup
.
parse
(
null
),
is
(
Collections
.<
TestGroup
>
emptySet
()));
assertThat
(
TestGroup
.
parse
(
null
),
equalTo
(
Collections
.<
TestGroup
>
emptySet
()));
}
@Test
public
void
parseEmptyString
()
throws
Exception
{
assertThat
(
TestGroup
.
parse
(
""
),
is
(
Collections
.<
TestGroup
>
emptySet
()));
assertThat
(
TestGroup
.
parse
(
""
),
equalTo
(
Collections
.<
TestGroup
>
emptySet
()));
}
@Test
public
void
parseWithSpaces
()
throws
Exception
{
assertThat
(
TestGroup
.
parse
(
"PERFORMANCE, PERFORMANCE"
),
is
((
Set
<
TestGroup
>)
EnumSet
.
of
(
TestGroup
.
PERFORMANCE
)));
equalTo
((
Set
<
TestGroup
>)
EnumSet
.
of
(
TestGroup
.
PERFORMANCE
)));
}
@Test
public
void
parseInMixedCase
()
throws
Exception
{
assertThat
(
TestGroup
.
parse
(
"performance, PERFormaNCE"
),
is
((
Set
<
TestGroup
>)
EnumSet
.
of
(
TestGroup
.
PERFORMANCE
)));
equalTo
((
Set
<
TestGroup
>)
EnumSet
.
of
(
TestGroup
.
PERFORMANCE
)));
}
@Test
public
void
parseM
is
sing
()
throws
Exception
{
public
void
parseM
equalTo
sing
()
throws
Exception
{
thrown
.
expect
(
IllegalArgumentException
.
class
);
thrown
.
expectMessage
(
"Unable to find test group 'm
is
sing' when parsing "
+
"testGroups value: 'performance, m
is
sing'. Available groups include: "
+
thrown
.
expectMessage
(
"Unable to find test group 'm
equalTo
sing' when parsing "
+
"testGroups value: 'performance, m
equalTo
sing'. Available groups include: "
+
"[LONG_RUNNING,PERFORMANCE,JMXMP,CI,CUSTOM_COMPILATION]"
);
TestGroup
.
parse
(
"performance, m
is
sing"
);
TestGroup
.
parse
(
"performance, m
equalTo
sing"
);
}
@Test
public
void
parseAll
()
throws
Exception
{
assertThat
(
TestGroup
.
parse
(
"all"
),
is
((
Set
<
TestGroup
>)
EnumSet
.
allOf
(
TestGroup
.
class
)));
assertThat
(
TestGroup
.
parse
(
"all"
),
equalTo
((
Set
<
TestGroup
>)
EnumSet
.
allOf
(
TestGroup
.
class
)));
}
@Test
public
void
parseAllExcept
()
throws
Exception
{
Set
<
TestGroup
>
expected
=
new
HashSet
<
TestGroup
>(
EnumSet
.
allOf
(
TestGroup
.
class
));
expected
.
remove
(
TestGroup
.
CUSTOM_COMPILATION
);
expected
.
remove
(
TestGroup
.
PERFORMANCE
);
assertThat
(
TestGroup
.
parse
(
"all-custom_compilation,performance"
),
equalTo
(
expected
));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录