-
Notifications
You must be signed in to change notification settings - Fork 137
/
MultipleVarGenSpec.groovy
40 lines (24 loc) · 1.05 KB
/
MultipleVarGenSpec.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package com.manning.spock.chapter5.custom
import spock.lang.*
import com.manning.spock.chapter5.intro.ImageNameValidator
class MultipleVarGenSpec extends spock.lang.Specification{
@Unroll("Checking harcoded image name #pictureFile with #result")
def "Valid images are PNG and JPEG files only"() {
given: "an image extension checker"
ImageNameValidator validator = new ImageNameValidator()
expect: "that all filenames are categorized correctly"
validator.isValidImageExtension(pictureFile) == result
where: "sample image names are"
[pictureFile,result] << [["sample.jpg",true],
["bunny.gif",false]]
}
@Unroll("Checking image name #pictureFile with result=#result")
def "Valid images are PNG and JPEG files only 2"() {
given: "an image extension checker"
ImageNameValidator validator = new ImageNameValidator()
expect: "that all filenames are categorized correctly"
validator.isValidImageExtension(pictureFile) == result
where: "sample image names are"
[pictureFile,result] << new MultiVarReader()
}
}