Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
LinuxSuRen
jenkins
提交
820c9b43
J
jenkins
项目概览
LinuxSuRen
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
820c9b43
编写于
4月 19, 2020
作者:
S
Stefan Spieker
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
minor test refactoring, mainly to use hamcrest matcher instead of deprecated junit assertThat
上级
7b654b25
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
28 addition
and
13 deletion
+28
-13
core/src/test/java/hudson/FilePathTest.java
core/src/test/java/hudson/FilePathTest.java
+9
-3
core/src/test/java/hudson/util/ArgumentListBuilderTest.java
core/src/test/java/hudson/util/ArgumentListBuilderTest.java
+5
-1
core/src/test/java/hudson/util/AtomicFileWriterTest.java
core/src/test/java/hudson/util/AtomicFileWriterTest.java
+3
-3
core/src/test/java/hudson/util/FileChannelWriterTest.java
core/src/test/java/hudson/util/FileChannelWriterTest.java
+1
-1
core/src/test/java/jenkins/security/ClassFilterImplSanityTest.java
...test/java/jenkins/security/ClassFilterImplSanityTest.java
+1
-1
core/src/test/java/jenkins/security/DefaultConfidentialStoreTest.java
...t/java/jenkins/security/DefaultConfidentialStoreTest.java
+5
-1
core/src/test/java/jenkins/security/apitoken/ApiTokenStatsTest.java
...est/java/jenkins/security/apitoken/ApiTokenStatsTest.java
+4
-3
未找到文件。
core/src/test/java/hudson/FilePathTest.java
浏览文件 @
820c9b43
...
...
@@ -54,7 +54,13 @@ import java.util.zip.ZipEntry;
import
java.util.zip.ZipOutputStream
;
import
static
org
.
hamcrest
.
CoreMatchers
.
is
;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
hamcrest
.
MatcherAssert
.
assertThat
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
Assert
.
fail
;
import
static
org
.
junit
.
Assume
.
assumeFalse
;
import
static
org
.
junit
.
Assume
.
assumeTrue
;
import
static
org
.
mockito
.
Mockito
.*;
...
...
@@ -293,7 +299,7 @@ public class FilePathTest {
}
@Issue
(
"JENKINS-6494"
)
@Test
public
void
getParent
()
throws
Exception
{
@Test
public
void
getParent
()
{
FilePath
fp
=
new
FilePath
((
VirtualChannel
)
null
,
"/abc/def"
);
assertEquals
(
"/abc"
,
(
fp
=
fp
.
getParent
()).
getRemote
());
assertEquals
(
"/"
,
(
fp
=
fp
.
getParent
()).
getRemote
());
...
...
@@ -491,7 +497,7 @@ public class FilePathTest {
}
@Issue
(
"JENKINS-13649"
)
@Test
public
void
multiSegmentRelativePaths
()
throws
Exception
{
@Test
public
void
multiSegmentRelativePaths
()
{
VirtualChannel
d
=
Mockito
.
mock
(
VirtualChannel
.
class
);
FilePath
winPath
=
new
FilePath
(
d
,
"c:\\app\\jenkins\\workspace"
);
FilePath
nixPath
=
new
FilePath
(
d
,
"/opt/jenkins/workspace"
);
...
...
core/src/test/java/hudson/util/ArgumentListBuilderTest.java
浏览文件 @
820c9b43
...
...
@@ -23,8 +23,12 @@
*/
package
hudson.util
;
import
static
org
.
junit
.
Assert
.*
;
import
static
org
.
hamcrest
.
MatcherAssert
.
assertThat
;
import
static
org
.
hamcrest
.
CoreMatchers
.*;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
java.io.IOException
;
import
java.util.HashMap
;
...
...
core/src/test/java/hudson/util/AtomicFileWriterTest.java
浏览文件 @
820c9b43
...
...
@@ -22,9 +22,9 @@ import java.util.Set;
import
static
org
.
hamcrest
.
CoreMatchers
.
equalTo
;
import
static
org
.
hamcrest
.
core
.
Is
.
is
;
import
static
org
.
hamcrest
.
core
.
StringContains
.
containsString
;
import
static
org
.
hamcrest
.
MatcherAssert
.
assertThat
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertThat
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
Assert
.
fail
;
import
static
org
.
junit
.
Assume
.
assumeThat
;
...
...
@@ -86,7 +86,7 @@ public class AtomicFileWriterTest {
}
@Test
public
void
createFile
()
throws
Exception
{
public
void
createFile
()
{
// Verify the file we created exists
assertTrue
(
Files
.
exists
(
afw
.
getTemporaryPath
()));
}
...
...
@@ -163,7 +163,7 @@ public class AtomicFileWriterTest {
@Issue
(
"JENKINS-48407"
)
@Test
public
void
checkPermissionsRespectUmask
()
throws
IOException
,
InterruptedException
{
public
void
checkPermissionsRespectUmask
()
throws
IOException
{
final
File
newFile
=
tmp
.
newFile
();
boolean
posixSupported
=
isPosixSupported
(
newFile
);
...
...
core/src/test/java/hudson/util/FileChannelWriterTest.java
浏览文件 @
820c9b43
...
...
@@ -13,7 +13,7 @@ import java.nio.charset.StandardCharsets;
import
java.nio.file.StandardOpenOption
;
import
static
org
.
hamcrest
.
core
.
IsEqual
.
equalTo
;
import
static
org
.
junit
.
Assert
.
assertThat
;
import
static
org
.
hamcrest
.
Matcher
Assert
.
assertThat
;
import
static
org
.
junit
.
Assert
.
fail
;
public
class
FileChannelWriterTest
{
...
...
core/src/test/java/jenkins/security/ClassFilterImplSanityTest.java
浏览文件 @
820c9b43
...
...
@@ -32,7 +32,7 @@ import java.util.stream.Collectors;
import
jenkins.util.MemoryReductionUtil
;
import
org.apache.commons.io.IOUtils
;
import
static
org
.
hamcrest
.
Matchers
.*;
import
static
org
.
junit
.
Assert
.
assertThat
;
import
static
org
.
hamcrest
.
Matcher
Assert
.
assertThat
;
import
org.junit.Test
;
import
org.jvnet.hudson.test.For
;
...
...
core/src/test/java/jenkins/security/DefaultConfidentialStoreTest.java
浏览文件 @
820c9b43
...
...
@@ -7,7 +7,11 @@ import java.nio.charset.Charset;
import
org.apache.commons.io.FileUtils
;
import
static
org
.
hamcrest
.
CoreMatchers
.*;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
hamcrest
.
MatcherAssert
.
assertThat
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.junit.rules.TemporaryFolder
;
...
...
core/src/test/java/jenkins/security/apitoken/ApiTokenStatsTest.java
浏览文件 @
820c9b43
...
...
@@ -52,10 +52,10 @@ import java.util.UUID;
import
java.util.stream.Collectors
;
import
static
org
.
hamcrest
.
Matchers
.*;
import
static
org
.
hamcrest
.
MatcherAssert
.
assertThat
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
junit
.
Assert
.
assertThat
;
@RunWith
(
PowerMockRunner
.
class
)
@PrepareForTest
(
ApiTokenPropertyConfiguration
.
class
)
...
...
@@ -108,6 +108,7 @@ public class ApiTokenStatsTest {
lastUsage
=
stats
.
getLastUseDate
();
assertNotNull
(
lastUsage
);
// to avoid flaky test in case the test is run at midnight, normally it's 0
assertThat
(
stats
.
getNumDaysUse
(),
lessThanOrEqualTo
(
1L
));
}
...
...
@@ -164,7 +165,7 @@ public class ApiTokenStatsTest {
}
@Test
public
void
testResilientIfFileDoesNotExist
()
throws
Exception
{
public
void
testResilientIfFileDoesNotExist
()
{
ApiTokenStats
tokenStats
=
createFromFile
(
tmp
.
getRoot
());
assertNotNull
(
tokenStats
);
}
...
...
@@ -193,7 +194,7 @@ public class ApiTokenStatsTest {
String
content
=
FileUtils
.
readFileToString
(
statsFile
.
getFile
(),
Charset
.
defaultCharset
());
// now there are multiple times the same id in the file with different stats
String
newContentWithDuplicatedId
=
content
.
replace
(
ID_1
,
ID_2
).
replace
(
ID_3
,
ID_2
);
FileUtils
.
write
(
statsFile
.
getFile
(),
newContentWithDuplicatedId
);
FileUtils
.
write
(
statsFile
.
getFile
(),
newContentWithDuplicatedId
,
Charset
.
defaultCharset
()
);
}
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录