@@ -37,6 +37,7 @@ public class LibraryCachingConfigurationTest {
37
37
private LibraryCachingConfiguration nullVersionConfig ;
38
38
private LibraryCachingConfiguration oneVersionConfig ;
39
39
private LibraryCachingConfiguration multiVersionConfig ;
40
+ private LibraryCachingConfiguration substringVersionConfig ;
40
41
41
42
private static int REFRESH_TIME_MINUTES = 23 ;
42
43
private static int NO_REFRESH_TIME_MINUTES = 0 ;
@@ -48,18 +49,25 @@ public class LibraryCachingConfigurationTest {
48
49
private static String MULTIPLE_EXCLUDED_VERSIONS_2 = "branch-2" ;
49
50
private static String MULTIPLE_EXCLUDED_VERSIONS_3 = "branch-3" ;
50
51
52
+ private static String SUBSTRING_EXCLUDED_VERSIONS_1 = "feature/test-substring-exclude" ;
53
+ private static String SUBSTRING_EXCLUDED_VERSIONS_2 = "test-other-substring-exclude" ;
54
+
51
55
private static String MULTIPLE_EXCLUDED_VERSIONS =
52
56
MULTIPLE_EXCLUDED_VERSIONS_1 + " " +
53
57
MULTIPLE_EXCLUDED_VERSIONS_2 + " " +
54
58
MULTIPLE_EXCLUDED_VERSIONS_3 ;
55
59
60
+ private static String SUBSTRING_EXCLUDED_VERSIONS =
61
+ "feature/ other-substring" ;
62
+
56
63
private static String NEVER_EXCLUDED_VERSION = "never-excluded-version" ;
57
64
58
65
@ Before
59
66
public void createCachingConfiguration () {
60
67
nullVersionConfig = new LibraryCachingConfiguration (REFRESH_TIME_MINUTES , NULL_EXCLUDED_VERSION );
61
68
oneVersionConfig = new LibraryCachingConfiguration (NO_REFRESH_TIME_MINUTES , ONE_EXCLUDED_VERSION );
62
69
multiVersionConfig = new LibraryCachingConfiguration (REFRESH_TIME_MINUTES , MULTIPLE_EXCLUDED_VERSIONS );
70
+ substringVersionConfig = new LibraryCachingConfiguration (REFRESH_TIME_MINUTES , SUBSTRING_EXCLUDED_VERSIONS );
63
71
}
64
72
65
73
@ Issue ("JENKINS-66045" ) // NPE getting excluded versions
@@ -91,6 +99,7 @@ public void getExcludedVersionsStr() {
91
99
assertThat (nullVersionConfig .getExcludedVersionsStr (), is (NULL_EXCLUDED_VERSION ));
92
100
assertThat (oneVersionConfig .getExcludedVersionsStr (), is (ONE_EXCLUDED_VERSION ));
93
101
assertThat (multiVersionConfig .getExcludedVersionsStr (), is (MULTIPLE_EXCLUDED_VERSIONS ));
102
+ assertThat (substringVersionConfig .getExcludedVersionsStr (), is (SUBSTRING_EXCLUDED_VERSIONS ));
94
103
}
95
104
96
105
@ Test
@@ -104,17 +113,22 @@ public void isExcluded() {
104
113
assertTrue (multiVersionConfig .isExcluded (MULTIPLE_EXCLUDED_VERSIONS_2 ));
105
114
assertTrue (multiVersionConfig .isExcluded (MULTIPLE_EXCLUDED_VERSIONS_3 ));
106
115
116
+ assertTrue (substringVersionConfig .isExcluded (SUBSTRING_EXCLUDED_VERSIONS_1 ));
117
+ assertTrue (substringVersionConfig .isExcluded (SUBSTRING_EXCLUDED_VERSIONS_2 ));
118
+
107
119
assertFalse (nullVersionConfig .isExcluded (NEVER_EXCLUDED_VERSION ));
108
120
assertFalse (oneVersionConfig .isExcluded (NEVER_EXCLUDED_VERSION ));
109
121
assertFalse (multiVersionConfig .isExcluded (NEVER_EXCLUDED_VERSION ));
110
122
111
123
assertFalse (nullVersionConfig .isExcluded ("" ));
112
124
assertFalse (oneVersionConfig .isExcluded ("" ));
113
125
assertFalse (multiVersionConfig .isExcluded ("" ));
126
+ assertFalse (substringVersionConfig .isExcluded ("" ));
114
127
115
128
assertFalse (nullVersionConfig .isExcluded (null ));
116
129
assertFalse (oneVersionConfig .isExcluded (null ));
117
130
assertFalse (multiVersionConfig .isExcluded (null ));
131
+ assertFalse (substringVersionConfig .isExcluded (null ));
118
132
}
119
133
120
134
}
0 commit comments