File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
src/test/groovy/ru/mystamps/web/util Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -206,4 +206,30 @@ class CatalogUtilsTest extends Specification {
206
206
' 2-1' | ' Range must be in an ascending order'
207
207
}
208
208
209
+ def ' parseCatalogNumbers() should return two elements for a range with two numbers' () {
210
+ when :
211
+ Set<String > numbers = CatalogUtils . parseCatalogNumbers(' 1-2' )
212
+ then :
213
+ numbers == [ ' 1' , ' 2' ] as Set
214
+ }
215
+
216
+ @Unroll
217
+ def ' parseCatalogNumbers() should throw exception for an invalid value (#numbers)' (
218
+ String numbers, String message) {
219
+
220
+ when :
221
+ CatalogUtils . parseCatalogNumbers(numbers)
222
+ then :
223
+ IllegalArgumentException ex = thrown()
224
+ ex. message == message
225
+ where :
226
+ numbers | message
227
+ ' 1-2-3' | ' Unexpected number of separators found: expected to have only one'
228
+ ' 1-z' | ' Unexpected a non-numeric range found'
229
+ ' z-2' | ' Unexpected a non-numeric range found'
230
+ ' 1 - 2 ' | ' Unexpected a non-numeric range found'
231
+ ' 1-1' | ' Range must be in an ascending order'
232
+ ' 2-1' | ' Range must be in an ascending order'
233
+ }
234
+
209
235
}
You can’t perform that action at this time.
0 commit comments