Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
f47bbb0d
S
spring-framework
项目概览
爱吃血肠
/
spring-framework
通知
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,体验更适合开发者的 AI 搜索 >>
提交
f47bbb0d
编写于
8月 12, 2015
作者:
S
Sam Brannen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polish tests
上级
f1514041
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
25 addition
and
44 deletion
+25
-44
spring-beans/src/test/java/org/springframework/beans/factory/serviceloader/ServiceLoaderTests.java
...ework/beans/factory/serviceloader/ServiceLoaderTests.java
+4
-9
spring-context/src/test/java/org/springframework/jmx/export/annotation/JmxUtilsAnnotationTests.java
...mework/jmx/export/annotation/JmxUtilsAnnotationTests.java
+5
-12
spring-core/src/test/java/org/springframework/core/io/support/PathMatchingResourcePatternResolverTests.java
.../io/support/PathMatchingResourcePatternResolverTests.java
+16
-23
未找到文件。
spring-beans/src/test/java/org/springframework/beans/factory/serviceloader/ServiceLoaderTests.java
浏览文件 @
f47bbb0d
...
...
@@ -26,6 +26,7 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import
org.springframework.beans.factory.support.RootBeanDefinition
;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
junit
.
Assume
.*;
/**
* @author Juergen Hoeller
...
...
@@ -35,9 +36,7 @@ public class ServiceLoaderTests {
@Test
public
void
testServiceLoaderFactoryBean
()
{
if
(!
ServiceLoader
.
load
(
DocumentBuilderFactory
.
class
).
iterator
().
hasNext
()){
return
;
}
assumeTrue
(
ServiceLoader
.
load
(
DocumentBuilderFactory
.
class
).
iterator
().
hasNext
());
DefaultListableBeanFactory
bf
=
new
DefaultListableBeanFactory
();
RootBeanDefinition
bd
=
new
RootBeanDefinition
(
ServiceLoaderFactoryBean
.
class
);
...
...
@@ -49,9 +48,7 @@ public class ServiceLoaderTests {
@Test
public
void
testServiceFactoryBean
()
{
if
(!
ServiceLoader
.
load
(
DocumentBuilderFactory
.
class
).
iterator
().
hasNext
()){
return
;
}
assumeTrue
(
ServiceLoader
.
load
(
DocumentBuilderFactory
.
class
).
iterator
().
hasNext
());
DefaultListableBeanFactory
bf
=
new
DefaultListableBeanFactory
();
RootBeanDefinition
bd
=
new
RootBeanDefinition
(
ServiceFactoryBean
.
class
);
...
...
@@ -62,9 +59,7 @@ public class ServiceLoaderTests {
@Test
public
void
testServiceListFactoryBean
()
{
if
(!
ServiceLoader
.
load
(
DocumentBuilderFactory
.
class
).
iterator
().
hasNext
()){
return
;
}
assumeTrue
(
ServiceLoader
.
load
(
DocumentBuilderFactory
.
class
).
iterator
().
hasNext
());
DefaultListableBeanFactory
bf
=
new
DefaultListableBeanFactory
();
RootBeanDefinition
bd
=
new
RootBeanDefinition
(
ServiceListFactoryBean
.
class
);
...
...
spring-context/src/test/java/org/springframework/jmx/export/annotation/JmxUtilsAnnotationTests.java
浏览文件 @
f47bbb0d
...
...
@@ -30,25 +30,21 @@ import static org.junit.Assert.*;
public
class
JmxUtilsAnnotationTests
{
@Test
public
void
testNotMXBean
()
throws
Exception
{
FooNotX
foo
=
new
FooNotX
();
assertFalse
(
"MXBean annotation not detected correctly"
,
JmxUtils
.
isMBean
(
foo
.
getClass
()));
public
void
notMXBean
()
throws
Exception
{
assertFalse
(
"MXBean annotation not detected correctly"
,
JmxUtils
.
isMBean
(
FooNotX
.
class
));
}
@Test
public
void
testAnnotatedMXBean
()
throws
Exception
{
FooX
foo
=
new
FooX
();
assertTrue
(
"MXBean annotation not detected correctly"
,
JmxUtils
.
isMBean
(
foo
.
getClass
()));
@Test
public
void
annotatedMXBean
()
throws
Exception
{
assertTrue
(
"MXBean annotation not detected correctly"
,
JmxUtils
.
isMBean
(
FooX
.
class
));
}
@MXBean
(
false
)
public
interface
FooNotMXBean
{
String
getName
();
}
public
static
class
FooNotX
implements
FooNotMXBean
{
@Override
...
...
@@ -57,14 +53,11 @@ public class JmxUtilsAnnotationTests {
}
}
@MXBean
(
true
)
public
interface
FooIfc
{
String
getName
();
}
public
static
class
FooX
implements
FooIfc
{
@Override
...
...
spring-core/src/test/java/org/springframework/core/io/support/PathMatchingResourcePatternResolverTests.java
浏览文件 @
f47bbb0d
...
...
@@ -19,6 +19,7 @@ package org.springframework.core.io.support;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
org.junit.Ignore
;
...
...
@@ -30,12 +31,13 @@ import org.springframework.util.StringUtils;
import
static
org
.
junit
.
Assert
.*;
/**
* If this test case fails, uncomment diagnostics in
* {@
code
assertProtocolAndFilenames} method.
* If this test case fails, uncomment diagnostics in
the
* {@
link #
assertProtocolAndFilenames} method.
*
* @author Oliver Hutchison
* @author Juergen Hoeller
* @author Chris Beams
* @author Sam Brannen
* @since 17.11.2004
*/
public
class
PathMatchingResourcePatternResolverTests
{
...
...
@@ -57,19 +59,13 @@ public class PathMatchingResourcePatternResolverTests {
private
PathMatchingResourcePatternResolver
resolver
=
new
PathMatchingResourcePatternResolver
();
@Test
public
void
testInvalidPrefixWithPatternElementInIt
()
throws
IOException
{
try
{
resolver
.
getResources
(
"xx**:**/*.xy"
);
fail
(
"Should have thrown FileNotFoundException"
);
}
catch
(
FileNotFoundException
ex
)
{
// expected
}
@Test
(
expected
=
FileNotFoundException
.
class
)
public
void
invalidPrefixWithPatternElementInIt
()
throws
IOException
{
resolver
.
getResources
(
"xx**:**/*.xy"
);
}
@Test
public
void
testS
ingleResourceOnFileSystem
()
throws
IOException
{
public
void
s
ingleResourceOnFileSystem
()
throws
IOException
{
Resource
[]
resources
=
resolver
.
getResources
(
"org/springframework/core/io/support/PathMatchingResourcePatternResolverTests.class"
);
assertEquals
(
1
,
resources
.
length
);
...
...
@@ -77,7 +73,7 @@ public class PathMatchingResourcePatternResolverTests {
}
@Test
public
void
testS
ingleResourceInJar
()
throws
IOException
{
public
void
s
ingleResourceInJar
()
throws
IOException
{
Resource
[]
resources
=
resolver
.
getResources
(
"java/net/URL.class"
);
assertEquals
(
1
,
resources
.
length
);
assertProtocolAndFilenames
(
resources
,
"jar"
,
"URL.class"
);
...
...
@@ -85,7 +81,7 @@ public class PathMatchingResourcePatternResolverTests {
@Ignore
// passes under Eclipse, fails under Ant
@Test
public
void
testC
lasspathStarWithPatternOnFileSystem
()
throws
IOException
{
public
void
c
lasspathStarWithPatternOnFileSystem
()
throws
IOException
{
Resource
[]
resources
=
resolver
.
getResources
(
"classpath*:org/springframework/core/io/sup*/*.class"
);
// Have to exclude Clover-generated class files here,
// as we might be running as part of a Clover test run.
...
...
@@ -101,19 +97,19 @@ public class PathMatchingResourcePatternResolverTests {
}
@Test
public
void
testC
lasspathWithPatternInJar
()
throws
IOException
{
public
void
c
lasspathWithPatternInJar
()
throws
IOException
{
Resource
[]
resources
=
resolver
.
getResources
(
"classpath:org/apache/commons/logging/*.class"
);
assertProtocolAndFilenames
(
resources
,
"jar"
,
CLASSES_IN_COMMONSLOGGING
);
}
@Test
public
void
testC
lasspathStartWithPatternInJar
()
throws
IOException
{
public
void
c
lasspathStartWithPatternInJar
()
throws
IOException
{
Resource
[]
resources
=
resolver
.
getResources
(
"classpath*:org/apache/commons/logging/*.class"
);
assertProtocolAndFilenames
(
resources
,
"jar"
,
CLASSES_IN_COMMONSLOGGING
);
}
@Test
public
void
testR
ootPatternRetrievalInJarFiles
()
throws
IOException
{
public
void
r
ootPatternRetrievalInJarFiles
()
throws
IOException
{
Resource
[]
resources
=
resolver
.
getResources
(
"classpath*:*.dtd"
);
boolean
found
=
false
;
for
(
Resource
resource
:
resources
)
{
...
...
@@ -156,12 +152,9 @@ public class PathMatchingResourcePatternResolverTests {
}
private
void
assertFilenameIn
(
Resource
resource
,
String
...
filenames
)
{
for
(
String
filename
:
filenames
)
{
if
(
resource
.
getFilename
().
endsWith
(
filename
))
{
return
;
}
}
fail
(
resource
+
" does not have a filename that matches any of the specified names"
);
String
filename
=
resource
.
getFilename
();
assertTrue
(
resource
+
" does not have a filename that matches any of the specified names"
,
Arrays
.
stream
(
filenames
).
anyMatch
(
filename:
:
endsWith
));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录