1
1
package com .cloudbees .jenkins .support .impl ;
2
2
3
- import static org .junit .Assert .assertFalse ;
4
- import static org .junit .Assert .assertTrue ;
3
+ import static org .hamcrest .MatcherAssert .assertThat ;
4
+ import static org .hamcrest .Matchers .hasItem ;
5
+ import static org .hamcrest .Matchers .not ;
6
+ import static org .hamcrest .text .MatchesPattern .matchesPattern ;
5
7
6
8
import com .cloudbees .jenkins .support .SupportTestUtils ;
7
9
import hudson .model .Label ;
@@ -30,7 +32,7 @@ public void addContents() throws Exception {
30
32
SupportTestUtils .invokeComponentToMap (new NodeRemoteDirectoryComponent (), agent .toComputer ());
31
33
32
34
String prefix = "nodes/slave/" + agent .getNodeName () + "/remote" ;
33
- assertTrue (output .keySet (). stream (). anyMatch ( key -> key . matches (prefix + "/support/.*.log" )));
35
+ assertThat (output .keySet (), hasItem ( matchesPattern (prefix + "/support/.*.log" )));
34
36
}
35
37
36
38
/*
@@ -46,7 +48,7 @@ public void addContentsWithExcludes() throws Exception {
46
48
new NodeRemoteDirectoryComponent ("" , "**/*.log" , true , 10 ), agent .toComputer ());
47
49
48
50
String prefix = "nodes/slave/" + agent .getNodeName () + "/remote" ;
49
- assertFalse (output .keySet (). stream (). anyMatch ( key -> key . matches (prefix + ".*/.*.log" )));
51
+ assertThat (output .keySet (), not ( hasItem ( matchesPattern (prefix + ".*/.*.log" ) )));
50
52
}
51
53
52
54
/*
@@ -62,7 +64,7 @@ public void addContentsWithIncludes() throws Exception {
62
64
new NodeRemoteDirectoryComponent ("support/*.log" , "" , true , 10 ), agent .toComputer ());
63
65
64
66
String prefix = "nodes/slave/" + agent .getNodeName () + "/remote" ;
65
- assertTrue (output .keySet (). stream (). anyMatch ( key -> key . matches (prefix + "/support/.*.log" )));
67
+ assertThat (output .keySet (), hasItem ( matchesPattern (prefix + "/support/.*.log" )));
66
68
}
67
69
68
70
/*
@@ -78,6 +80,6 @@ public void addContentsWithMaxDepth() throws Exception {
78
80
new NodeRemoteDirectoryComponent ("" , "" , true , 1 ), agent .toComputer ());
79
81
80
82
String prefix = "nodes/slave/" + agent .getNodeName () + "/remote" ;
81
- assertFalse (output .keySet (). stream (). anyMatch ( key -> key . matches (prefix + "/support/.*.log" )));
83
+ assertThat (output .keySet (), not ( hasItem ( matchesPattern (prefix + "/support/.*.log" ) )));
82
84
}
83
85
}
0 commit comments